Petros Makris
Petros Makris

Reputation: 522

Calling ` google.accounts.id.prompt` returns error 400 for browser that is does not have a google session

When calling prompt() from a browser that has a google session

google.accounts.id.initialize({
    client_id: MY_GOOGLE_CLIENT_ID,
    auto_select: false,
    callback: handleCredentialResponse
})
google.accounts.id.prompt()

I get to see the one-tap showing up and a subsequent call to my handleCredentialResponse callback.

But, If I try from a different browser session (clean chrome session) that is not logged into google I see a 400 error when the js library tries to contact google:

https://accounts.google.com/gsi/status?client_id=MY_GOOGLE_CLIENT_ID&as=...

The actual response is

400. That’s an error.

The server cannot process the request because it is malformed. 
It should not be retried. That’s all we know.

What do I need to do in order to show the 'sign-in with google' popup in such a case?

Upvotes: 3

Views: 363

Answers (0)

Related Questions