Refresh Token not working- HTTP Patch request

Options

Just when I thought I had this token thing down, it isn't working. It worked for one day now I'm getting this error when trying to do the PATCH

fe68daa61697235c79247bf45fd26ec6-huge-im

I had a token, refreshed it which I thought was good for 365 days?

From the tutorial, it looked like this, so I took the access token on the first line.

c2f042446f57f5f80362650d768d13ab-huge-im

Do I need a preserve refresh token?

Also, I added Validate user identity token to authorize the users using the app. Could that through it off because it was already using my refresh token?

Comments

  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary Kudos 5 PowerUp Challenge #3 Gift Management Name Dropper

    @Carol Grant
    user identity token is not the same as the auth token or refresh token use for calling SKY API.

    preserve refresh token shouldn't be use normally, as you want a new refresh token that will have the extended expiration.

    your status code error is 404, which means resource not found. Not auth token related.

    which patch endpoint are you trying to use, and did you make sure that the record you are trying to patch exists and can be patched?

  • @Alex Wong- okay, I did have to fix one thing but now I am getting the expired token error.

    "statusCode": 401,

    "message": "The required Authorization header was missing or invalid, or the token has expired",

    "status": 401,

    "title": "The required Authorization header was missing or invalid, or the token has expired"

    Let me review my steps again because I have to do this again:

    Go to Postman, get original token that is good for 60 minutes. Run the Refresh token flow right before it expires and get a new one.

    Here's my refresh flow:

    a2c3ecbe61712311732f5380532cdbb9-huge-im

    When this runs, it shows below. Is the new token should be the first one “access token”, correct? And that is good for 365 days? I don't think I'm doing this correctly.

    e3f14162707d2f8a6e5eb2a5a4f07f93-huge-im
  • Alex Wong
    Alex Wong Community All-Star
    Ninth Anniversary Kudos 5 PowerUp Challenge #3 Gift Management Name Dropper

    @Carol Grant
    yea, you are not doing it correctly.

    access_token is what you need to use in the bearer header, that is always only good for 60 minutes.

    refresh_token is what you need to call the refresh token endpoint to get a new access_token, again the access_token is good for 60 minutes only. The refresh_token is good for 365 days to get new access_token.

    Does that make sense?

  • @Alex Wong- I understand now and that's a bummer that the access token has to be refreshed every 60 minutes. And now I understand why your previous solution runs every 59 minutes and saves it to a secure area. I guess I'll implement that now.

Categories