Level up your Box knowledge with brand new learning paths on Box University. Visit training.box.com to get started

Client Credentials Grant Expiration Time

Answered
New post

Comments

3 comments

  • Official comment
    jcleblanc

    Hi Wesley,

    That's correct, expires_in will be the time in seconds until token expiration. You can see more detail about the token object response over here.

    - Jon

    Comment actions Permalink
  • Wesley Lee

    Thanks for the response Jon. Follow up question:

     

    The documentation you sent me has a refresh token as a part of the response payload, but mine does not. I am using the client credentials grant to obtain a JWT and the response looks like this:

     

    {"access_token":"<REDACTED>","expires_in":4102,"restricted_to":[],"token_type":"bearer"}

     

    How would I refresh this token once it expires?

     

    Thanks,

    0
    Comment actions Permalink
  • jcleblanc

    Hi Wesley,

    The reference guide can be a bit confusing in this instance because it incorporates all possible options / values for all of our different auth types. Here's what you'll need to know for client credential grant.

    The payload that you're seeing doesn't include a refresh token, like what you would see within standard OAuth 2 (when a user signs in to grant your app permissions). With those app types you would call the refresh token endpoint using that refresh token.

    In your case, it's easier - when the token expires just call the same request access token endpoint that you did to get the first access token, which will give you a new one to use. 

    - Jon

    0
    Comment actions Permalink

Please sign in to leave a comment.