I am trying to access to an API that uses OAuth2 authentication with the Refresh Token
grant.
So, to request this API, I need a Client Id
, a Client Secret
and a Refresh Token
.
Using https://console.cloud.google.com/apis/credentials, I created a new OAuth 2.0 Client ID
, which gives me a Client Id
and a Client Secret
.
But I struggle generating a Refresh Token.
By looking at this article, it looks like I need to execute the following POST query :
curl -X POST -d "code=[CODE]&client_id=[CLIENT_ID]&client_secret=[CLIENT_SECRET]&redirect_uri=[REDIRECT_URI]&grant_type=authorization_code" https://oauth2.googleapis.com/token
To retrieve the CODE
parameter, I need to do another call to this URL : https://accounts.google.com/o/oauth2/v2/auth?scope=[SCOPE]&access_type=offline&include_granted_scopes=true&response_type=code&redirect_uri=[REDIRECT_URI]&client_id=[CLIENT_ID]
This call opens the Google login page.
However, I don't know how to log in with an OAuth 2.0 Client ID
. I don't have an email linked to these credentials.
Am I following the correct steps to retrieve a Refresh Token
in my use case, and if so, what am I missing here ?