Is There a Way to Re-Generate OAuth Refresh Token?

Sadat
Contributor

My question is regarding the OAuth flow: Is there a way to request re-generation of the refresh token for a user? (besides reinstalling the app and going through the installation flow again) 

1 Accepted solution
SanjayKumar
Solution
Guide | Platinum Partner
Guide | Platinum Partner

Hi @Sadat

To obtain OAuth access and refresh tokens, follow these steps:

  1. Make a URL-form encoded POST request to /oauth/v1/token.

    • In the request body, include the following authentication parameters:
      • client_id
      • client_secret
      • The code returned via the redirect URL.
  2. Redirect URL and code generation:

    • After a user authorizes your app, the redirect URL will include a code value.
    • Use this code to generate the initial access token and refresh token.
  3. Access token lifetime:

    • Access tokens are short-lived.
    • You can verify their lifespan using the expires_in parameter, which provides the lifetime in seconds.
  4. Generating new access tokens:

    • To generate a new access token, make another URL-form encoded POST request to /oauth/v1/token.
    • In the request body, specify:
      • grant_type
      • client_id
      • client_secret
      • refresh_token

For additional details, you can check here.

Did my post help answer your query? Help the community by marking it as a solution.
Thanks.

Talk to Our HubSpot Expert

Marketing Automation Agency | RevOps & CRM Consultant

Did my post help answer your query? Help the community by marking it as a solution.

View solution in original post

0 Upvotes
1 Reply 1
SanjayKumar
Solution
Guide | Platinum Partner
Guide | Platinum Partner

Hi @Sadat

To obtain OAuth access and refresh tokens, follow these steps:

  1. Make a URL-form encoded POST request to /oauth/v1/token.

    • In the request body, include the following authentication parameters:
      • client_id
      • client_secret
      • The code returned via the redirect URL.
  2. Redirect URL and code generation:

    • After a user authorizes your app, the redirect URL will include a code value.
    • Use this code to generate the initial access token and refresh token.
  3. Access token lifetime:

    • Access tokens are short-lived.
    • You can verify their lifespan using the expires_in parameter, which provides the lifetime in seconds.
  4. Generating new access tokens:

    • To generate a new access token, make another URL-form encoded POST request to /oauth/v1/token.
    • In the request body, specify:
      • grant_type
      • client_id
      • client_secret
      • refresh_token

For additional details, you can check here.

Did my post help answer your query? Help the community by marking it as a solution.
Thanks.

Talk to Our HubSpot Expert

Marketing Automation Agency | RevOps & CRM Consultant

Did my post help answer your query? Help the community by marking it as a solution.

0 Upvotes