Roland
Roland

Reputation: 681

Error when using google calendar API "Request had invalid authentication"

I'm using this API to get some events: https://www.googleapis.com/calendar/v3/calendars/primary/events?timeMin={time}&timeMax={time}Z&timeZone={zone}

And using a access token as a Bearer token. I used this request so many times and all worked.

Now I'm getting this error:

{
"error": {
    "code": 401,
    "message": "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.",
    "errors": [
        {
            "message": "Invalid Credentials",
            "domain": "global",
            "reason": "authError",
            "location": "Authorization",
            "locationType": "header"
        }
    ],
    "status": "UNAUTHENTICATED"
}

}

Upvotes: 0

Views: 66

Answers (1)

Roland
Roland

Reputation: 681

Found the problem. The token was expired and I didn't realize at the time. But the error message didn't help. Why don't they just sent a error like (token expired or token invalid)?

Upvotes: -1

Related Questions