I saw that the Renew Token functionality in API explorer (https://developer.squareup.com/reference/square/o-auth-api/renew-token/explorer) has been deprecated. I’m wondering what should I do to renew the token.
You will want to use ObtainToken in version 2019-03-13 or newer. In the request body specify the non-expired legacy access token as follows:
- Set the
grant_typeparameter to “migration_token”
- Set the
migration_tokenparameter to the non-expired legacy OAuth access token to migrate.
In the response Square returns a new access token along with a refresh token. You should persist both the access token and refresh token, and use these credentials going forward.
Thank you Bryan. So you mean to say we will not be using Refresh Token to get a new Access Token?
Moving forward you will use the
refresh_token to get a new access token, yes. The next time you need to get a new access token for the merchant, you would use
refresh_token and supply the
refresh_token instead of a
migration_token within the
I’m confused here. So when do I use non expired access token and when do I use refresh token to get a new access token?
Since there is no more
RenewToken, you never use an access token to get a new access token. You will always use a refresh token moving forward (or a
code the first time you’re authing a merchant).
Where do I find the refresh token? I already have an access token but I need to find the refresh token in order to renew it.
When you first use ObtainToken, it should be returning an access token along with a refresh token (if you were using
authorization_code). If you do not have the refresh token saved, you’ll need to go through the entire OAuth flow again, starting with the authorization link.
Ok. Thank you for your reply.