Google Oauth / social login fail on HTTPS site (SOLVED)

Hello,

I am new here and just testing ERPNext. It’s awesome, you have done a good work. Thank you.

I have an issue with Google Oauth, which seems to be working well on HTTP site but not work if I access the same site through secure HTTPS. It fails to redirect to {website}/api/method/frappe.templates.pages.login.login_via_google only on HTTPS site.

The following is the error message from Google. Thank you :

That’s an error.

Error: redirect_uri_mismatch

Application: ERPNext-test

You can email the developer of this application at: lucky@mail

The redirect URI in the request: https://{website}/api/method/frappe.templates.pages.login.login_via_google did not match a registered redirect URI.

Lucky

I manage to solve this after browsing to Not Found.

edit: new url path https://frappe.io/docs/user/en/guides/deployment/how-to-enable-social-logins

Basically, I need to change both Authorized JavaScript origins and Authorized redirect URIs to https site. Therefore:

  • https://{website}
  • https://{website}/api/method/frappe.templates.pages.login.login_via_google

are setting used for HTTPS site, while:

  • http://{website}
  • http://{website}/api/method/frappe.templates.pages.login.login_via_google

are setting used for HTTP site.

Lucky

1 Like