I am able to successfully get a PCM authorization code and use it to get a access token but it only works once. Is that the correct behaviour? Seems like it should work indefinitely so the user does not have to continuously authorize a partner. Or once I get a access token I should only use the refresh token afterwards?
Works the first time I request a access token:
Example PCM authorization code:
4/0AY0e-e45jfjsl_KPdjke_BzKgsBirc....
╰─ curl -L -X POST 'https://www.googleapis.com/oauth2/v4/token?client_id=MY-CLIENT-ID&client_secret=MY-CLIENT_SECRET&code=MY-AUTH-CODE&grant_type=authorization_code&redirect_uri=https://www.google.com'
{
"access_token": "ya29.a0AfH6SMAgv...",
"expires_in": 3599,
"refresh_token": "1//04721e...",
"scope": "https://www.googleapis.com/auth/sdm.service",
"token_type": "Bearer"
}
On subsequent tries to use the PCM authorization code it fails. The only way to use it again is to recreate the PCM authorization code.
╰─ curl -L -X POST 'https://www.googleapis.com/oauth2/v4/token?client_id=MY-CLIENT-ID&client_secret=MY-CLIENT_SECRET&code=MY-AUTH-CODE&grant_type=authorization_code&redirect_uri=https://www.google.com'
{
"error": "invalid_grant",
"error_description": "Bad Request"
}