Google API authentication fails.

Asked 1 years ago, Updated 1 years ago, 93 views

Google API often fails to authenticate, and I am having trouble identifying the cause and solution.
Please let me know if you know.

● Problem Symptoms
With only one account logged into your Google account,
When I try to log in with my Google account again with Auth2 authentication in Google API, I get a popup_closed_by_user error (popup closed from user) and
Authentication fails.
More often than not, IE less often occurs in Chrome.
However, if you have already logged in to your Google account,
The above authentication error does not occur and is successfully authenticated.
 

●Environment
Operating System: Windows 7 (64bit)
Chrome: 66.0.3359.181
IE: 11.0.9600.18402

Note: Browser pop-up blocker has been cleared.

●Google API
Authentication of the gapi.auth2.authorize method fails.
URL: https://developers.google.com/identity/sign-in/web/reference

The following parameters are specified:

gapi.auth2.authorize({//OAuth2.0 authentication).After authentication, the callback function is called.
  'client_id': clientId,
  'scope': "https://www.googleapis.com/auth/calendar https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile",
  'immediate': true
}, 

javascript google-api

2022-09-30 11:19

1 Answers

The reference in the question (URL: https://developers.google.com/identity/sign-in/web/reference) has a warning that it is not recommended to use 'gapi.auth2.authorize' as follows:

Warning: This section covers features that are not recommended for most uses. Make sure that the methods are included in the Guides don't work for your use case before using such features.

If there is a problem using 'gapi.auth2.authorize', I think it would be better to use 'gapi.auth2.init'.
Note: https://developers.google.com/identity/protocols/OAuth2UserAge


2022-09-30 11:19

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.