I have to use OAuth ObtainToken[POST /oauth2/token - Square API Explorer] endpoint to generate a new access token in my implementation when my access token is expired. But when I created my developer account in Square, after creating a new application I could see access token in Credentials Tab and application id, secret in OAuth tab, not able to find the refresh token associated with this application’s access token. Could someone please help me on how can I retrieve my refresh token of my application? Thanks!
The credentials that you see in the Developer Dashboard are for pulling information from your Square account. They don’t expire which is why there isn’t a refresh_token
. The refresh_token
will be returned when calling Obtain_token
too authorize
. At that point you’ll need to securely store the tokens since the refresh_token
isn’t available after that.
Thanks for the clarity @Bryan-Square . But, to execute the Obtain_token API
using developer account access token, I would need to pass in the refresh token as a payload since my grant_type I would need to choose as refresh_token. To achieve this, somehow I need to have the refresh token in prior. Could you please assist here? Thanks!
The obtain_token
API call doesn’t require the access token. It just needs the application secret. If you’ve already made the initial obtain_token
call with the grant_type
of authorize
you’ll get the refresh_token
in the response. At that point you’ll need to securely store the token as it’s not retrievable via API call or in the Dashboard.