400 'Bad Request' with Refresh Token request
Closed this issue · 1 comments
Hats off to you for an awesome set of Google libraries for Salesforce! My use case below works great until the access token expires. The ffhttp_OAuthClient
class proceeds to send a request to obtain a new access token (using the refresh token) but the request fails with a 400 'Bad Request' response.
Use Case
Create folders and files in Google Drive in an 'after insert' trigger for a standard object.
Configuration
I'm using the Configuration setup outlined in the Google Drive API Framework project.
The refresh token request appears to be correct:
grant_type=refresh_token&client_id=1234567890123-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.apps.googleusercontent.com&client_secret=XXXXXXXXXXXXXXXXX-YYYYYY&redirect_uri=https%3A%2F%2Fgoo.cs91.my.salesforce.com%2Fapex%2Fconnector&refresh_token=1/XXXXXXXXXXXXXXXX-YYYYYYYYYYYYYYYYYYYYYYYYYY
Troubleshooting Steps
- re-creating the client credentials in Google Cloud Platform.
- re-creating the Connector Type and Connector.
- using 'access_type=offline' and 'access_type=offline&approval_prompt' in the Connector's Extra Url Parameters field.
Any ideas on how to further troubleshoot this? The last message on this post mentions a similar problem.
Thanks so much!
Marisa
This issue can be closed. The Token Endpoint URL appears to be outdated in the "Create a Connector in Salesforce" section of the Google Drive README. Once I updated the Connector to use the correct URL (https://www.googleapis.com/oauth2/v4/token), the refresh token could be successfully used to request a fresh access token. I'll open an issue on the ffhttp-googledrive project for further confirmation.