I'm trying to use oauth 2.0 for the google + api on my site, and I keep getting:
{
"error": {
"errors": [{
"domain": "global",
"reason": "authError",
"message": "Invalid Credentials",
"locationType": "header",
"location": "Authorization"
}],
"code": 401,
"message": "Invalid Credentials"
}
}
The thing is, I don't know why this is happening. I have a valid access token from google, but google tells be it is invalid. I know that the token has not expired because the json data is request from google within 10 seconds of getting the access token. Here is the process that I'm using:
- Get user to authorize the request.
- Gets request code from google.
- Uses
cUrl
to request access token with the request code from google. - Puts the access code into a php session.
- redirects back to the main page.
- Main page detects session variable is set and doesn't display login link.
- Php on main page uses
readFile
to get the json response from google. - Google returns invalid credentials.
here is a example uri generated by php that is inserted into readFile:
Help please?