0
votes

I want to store my json object to google drive. And google authentication is working fine. But when I am calling google drive api, it returns 401 error.

Error Screenshot

I set authentication, content-type, and content-length to api headers. Not sure why this happen.

1
A 401 error is an invalid credential error. Have you made sure the authentication credentials are correct?AlvinArulselvan
yes, I did. I did google auth with gapi, and I can print access tokenRyuhei Matsuda
Please edit your question and include a mcve we can not help you fix issues with your code without seeing it.DaImTo

1 Answers

0
votes

401: Invalid Credentials Invalid authorization header. The access token you're using is either expired or invalid.

{
  "error": {
    "errors": [
      {
        "domain": "global",
        "reason": "authError",
        "message": "Invalid Credentials",
        "locationType": "header",
        "location": "Authorization",
      }
    ],
    "code": 401,
    "message": "Invalid Credentials"
  }
}

Suggested action: Refresh the access token using the long-lived refresh token. If this fails, direct the user through the OAuth flow, as described in Authorizing Your App with Google Drive.