GoogleUser.getAuthResponse occasionally returns null

140 views
Skip to first unread message

ksk...@republiccharterschools.org

unread,
Sep 13, 2016, 12:37:35 PM9/13/16
to Google API JavaScript Client
I use the javascript library to let users sign to my web app and send the resulting id_token to the server so I can identify them there. A problem I've been trying to track down is that the AuthResponse object seems to be missing randomly. It's sometimes the same users, but never seems to be consistent for them (sometimes they get the error, sometimes they don't).

I've followed https://developers.google.com/identity/sign-in/web/sign-in to set up my code. Here's how I access the id_token in my onSignIn function:
function onSignIn(googleUser) {
      var id_token = googleUser.getAuthResponse().id_token;
   // POST to the server

Occasionally the post request wouldn't have the id_token in it, so I started sending up the entire googleUser object to try to debug. When there is no id_token, it seems the entire authResponse is missing from the user object. Everything else will be there (profile picture url, name, email), just no authResponse data (access_token, id_token, login_hint, ...).

Could I be doing something incorrectly with the javascript library? Any help is greatly appreciated. And I can provide any more details that are needed.
Reply all
Reply to author
Forward
0 new messages