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.

I set authentication, content-type, and content-length to api headers. Not sure why this happen.
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.

I set authentication, content-type, and content-length to api headers. Not sure why this happen.
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.