Need a link to Google Login/Social Login that can be embedded in any web page/portal

hi guys, I’m thrilled with the power and simplicity of ERPnext. I’m exploring integration using Google as Social login.

I was able to setup Google Oauth2 and it works great.

Now, I’m looking to embed a common link as an Item in the main menu on a website. (for social login to ERPnext using Google Oauth2), So any user (system user in ERPnext) can click the link, and login seamlessly to ERPnext.

I’m wondering what that link would look like? Is it possible? Is yes, what would that link to ERPnext using Google Oauth2 look like?

As an example, I tried below link (under the google Login icon generated auto by erpnext), but how would one make the link work independent of the client_id?

https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email&redirect_uri=http%3A%2F%2Ferpnext.net%2Fapi%2Fmethod%2Ffrappe.templates.pages.login.login_via_google&response_type=code&client_id=XXXYYYZZZ.apps.googleusercontent.com

This looks like a common need if one has to use Social link for multiple users. Anyone knows how can this be possible solved?

Thanks,
Mit.

Maybe you can create a re-direct that does that. The oauth link should originate form the erpnext page.

Thanks for your quick response and guidance. I will try it out.

The problem faced is that there are few users that need to be authenticated via Google login (they would access different company’s data, mutually exclusively). Currently, the ERPnext generates a specific link with client_id, etc. I’m looking to have a generic link (without client ID, etc.) that would work for any user (also registered in ERPNext ) and can be embedded as a menu item or so. An example of it will be:

https://accounts.google.com/o/oauth2/auth?scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email&redirect_uri=http%3A%2F%2Ferpnext2015.cloudapp.net%2Fapi%2Fmethod%2Ffrappe.templates.pages.login.login_via_google

or

so, with a generic link (auto generated by ERPnext) like below would take the user directly to the website logged in (if user is already authenticated by google ) or asked for Google emailID/password if not authenticated.



If I currently use the above link, I get errors (expectedly so) as shown in the image:

If you have few minutes to spend, it would be valuable and great if you can take a look into this generic need for everyone.

Thanks,
Mit.

@mitmak does not seem like a generic request. Frappe uses rauth

See this if you want to dig deeper.

Sure, I will dig deeper into it.

Thanks.