Can I get help in understanding the SmartSheet refresh token lifecycle ?

Options
nishikamanira
nishikamanira ✭✭✭
edited 05/14/25 in API & Developers

Can I get help in understanding the SmartSheet refresh token lifecycle ? I recently created a new managed Oauth App and noted down its clientId and secret. Using these 2, I generated an auth code and then generated access token and refresh token. From other forum post, got to know that refresh token doesn't have expiry. However, I get access denied error on API access and on refreshing the access token, getting below error:

{    "errorCode": 1071,    "message": "Invalid Grant. The authorization code or refresh token provided was invalid.",    "error": "invalid_grant",    "refId": "aonvq0"}

Note - Managed app was created just 10-12 hours before this issue occurred.

What could be causing this issue?

Answers

  • prime_nathaniel
    prime_nathaniel ✭✭✭✭✭

    @nishikamanira nothing you stated sounded wrong, it is a standard Oauth implementation. Are you submitting in correct content type?

    Principal Consultant | System Integrations

    Prime Consulting Group

    Email: info@primeconsulting.com

    Follow us on LinkedIn!

  • @prime_nathaniel Thanks for checking. I am using the correct content type. Below is the curl request. Issue is that in about 10-12 hours, when there is need to get new access token if I try to get it with below request, I am getting this error response:

    curl --location 'https://api.smartsheet.com/2.0/token' --header 'Content-Type: application/x-www-form-urlencoded' --data-urlencode 'grant_type=refresh_token' --data-urlencode 'refresh_token=zo1i5livlf0a632duodxz28zfc' --data-urlencode 'client_id=xxxxxudyjaxxx2' --data-urlencode 'client_secret=xxxxxxmsaboxxxwu'

    Error response:

    {
    "errorCode": 1071,
    "message": "Invalid Grant. The authorization code or refresh token provided was invalid.",
    "error": "invalid_grant",
    "refId": "rxct37"
    }

    This probably shows that the refresh token has expired. But as per earlier threads of this forum, I read that refresh token doesn't expire. Why is the refresh token expiring in my case and that too in only about 10-12 hours?

NEW Smartsheet API Documentation - bookmark the updated link! https://developers.smartsheet.com