I am able to successfully authorize a user through Partner Connections Manager, but when I request tokens from https://www.googleapis.com/oauth2/v4/token
using my authorization code, I do not receive a refresh_token
in the response, only an access_token
is present:
{
access_token: 'my-access-token',
expires_in: 3599,
scope: 'https://www.googleapis.com/auth/sdm.service',
token_type: 'Bearer'
}
Make sure to specify access_type=offline
in your Partner Connections Manager (PCM) URL. Omitting it assumes access_type=online
, which does not provide a refresh token.
For example, the PCM URL should look something like this, where access_type=offline
:
https://nestservices.google.com/partnerconnections/project-id/auth?
redirect_uri=my-redirect-uri&
access_type=offline&
prompt=consent&
client_id=my-client-id&
response_type=code&
scope=https://www.googleapis.com/auth/sdm.service
Then, the subsequent token response from https://www.googleapis.com/oauth2/v4/token
should have what you expect:
{
"access_token": "my-access-token",
"expires_in": 3599,
"refresh_token": "my-refresh-token",
"scope": "https://www.googleapis.com/auth/sdm.service",
"token_type": "Bearer"
}
For more information, see Authorize an Account on the Device Access site.