OAuth2.0 token strange behaviour (Invalid Credentials 401)

后端 未结 13 1643
無奈伤痛
無奈伤痛 2020-12-05 00:13

Usually, Google OAuth2.0 mechanism is working great.

  1. The user confirms permission to access Google account with selected scopes.
  2. The refresh token is
13条回答
  •  悲&欢浪女
    2020-12-05 00:20

    Maybe this is helpful to someone:

    I had a similar issue using the JavaScript Google-API client for Calendar API. At random times it would work but mostly I got the same error. Adding scopes, testing key, nothing helped. After a few hours I found this solution, no idea why it works but it solved the issue for me:

    gapi.client.init({
        'apiKey': API_KEY,  <-- DOESN'T WORK
        'clientId': CLIENT_ID,
        'discoveryDocs': DISCOVERY_URLS,
        'scope': SCOPE
    }).then(function() {
        // gapi.client.setApiKey(API_KEY); <-- ADD THIS
    })
    

提交回复
热议问题