Google-api-javascript-client: Is it possible to get a id_token without creating a session for the user?

Created on 17 Dec 2017  路  1Comment  路  Source: google/google-api-javascript-client

Hi everyone,

When user signs in using "Google Sign-in button" in my SPA, I receive id_token from callback and pass it to my backend. In response, my backed issues its own token for further session management.

Basically receiving id_token from callback is all I need.

I don't like that I need to take care of calling Gapi.auth2.getAuthInstance().signOut() when signing user out. Because of that, I need to make sure the library is initialized on all pages where I have "sign out" button, instead of just placing it inside a single compontent that renders sign in page.

Is there a way to use this library to request id_token from Google, without actually creating any session for the user?

Best,
Marek

Most helpful comment

@marekciupak you can use gapi.auth2.authorize for such one-off use case.

>All comments

@marekciupak you can use gapi.auth2.authorize for such one-off use case.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

blmiles picture blmiles  路  5Comments

phyllisstein picture phyllisstein  路  3Comments

indapublic picture indapublic  路  6Comments

wonderfly picture wonderfly  路  5Comments

mesqueeb picture mesqueeb  路  5Comments