“immediate_failed” - Could not automatially log in the user

前端 未结 5 1009
[愿得一人]
[愿得一人] 2020-12-11 02:25

I have a problem when I developed my website with Google+ sign-in: I did step by step that the doc told me but I always failed at step4: https://developers.google.com/+/web/

5条回答
  •  既然无缘
    2020-12-11 02:29

    Note that in the sample code you pointed to, the "immediate_failed" check is commented out. This is intentional, since the first time a user encounters the Sign-in button on the page, it will fail.

    The reason it fails is that when the page first loads, before the user even presses the button, a request is sent to Google to determine if the user has already logged in (via Google or another site, for example). If they are - there is no need for them to log in again, so the button never needs to be shown. But if they have not been logged in already, you will get the "immediate_failed" response, and will need to either show (or not clear) the button.

    tl;dr - Don't worry aout getting immediate_failed when the page first loads. This is normal.

提交回复
热议问题