Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refreshing expired tokens #640

Open
keturn opened this issue Feb 8, 2018 · 0 comments
Open

refreshing expired tokens #640

keturn opened this issue Feb 8, 2018 · 0 comments

Comments

@keturn
Copy link

keturn commented Feb 8, 2018

Downscoped tokens only live for about an hour.

So when viewing a long video — especially if you pause it for a while and come back later — the viewer stops with an error message, and the load event handler is sent an error like this:

Shaka error. Code = 1001, Category = 1, Severity = 2, Data = https://public.boxcloud.com/api/2.0/internal_files/269427057885/versions/283639980141/representations/dash/content/audio/0/292.m4s?access_token=1!big...Long...token&box_client_name=box-content-preview&box_client_version=1.24.0,401,,[object Object]

when Shaka's request for that next audio or video segment is denied with a 401 response.

(The players for other document types may have similar issues, but video is the one we're running into this issue with on a daily basis.)

To address this we need a few things:

  1. Know when it's time to replace the token, by
    a. detecting a "token expired" failure response when it happens, or
    b. learning up-front what the token's lifetime is when it's first provided to the Preview, or
    c. given a token, use some Box "tell me about this token" API to determine its expiration time.
  2. Have some way to update the token used by the Preview.
  • Turns out this already exists! Preview has an updateToken method. Also, accessToken may be a Promise-returning function, in which case it might not need to do updateToken at all, just re-get using the already provided generator.
  • but that documentation isn't published anywhere, which I'll file under issue publish API documentation #641
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant