Nimrod Nimrod - 7 months ago 24
Javascript Question

Packaged Chrome App - Auto Google Login?

I've made a basic Chrome app that simply contains web pages displayed through the webview tag.

I have tried implementing a Google auto login function using oAuth2 but without success. However, if a user logs in manually, he remains logged in throughout the Chrome session, even when the app reopens.

Can anyone explain to me please how does it work, where are the parameters that pass into the login when I reopen the app in the same Chrome session?

Answer

To implement auto login function, use OpenID. Google's OAuth 2.0 APIs can be used for both authentication and authorization.

Before your application can use Google's OAuth 2.0 authentication for user login, you must set up a project in the Google Developers Console to obtain OAuth 2.0 credentials. You can also use the Developers Console to create a service account and do other tasks.

Here's a link that gives you complete descriptions of parameters needed for authentication: https://developers.google.com/identity/protocols/OpenIDConnect#re-consent

Your request access to this information using the scope parameter which your app includes in its authentication request. Also, include the prompt parameter to specifies whether the authorization server prompts the user for reauthentication and consent. You may use prompt(none) this means that the authorization server does not display any authentication or user odnsent screens.