snobu / destreamer

Save Microsoft Stream videos for offline enjoyment.
MIT License
2.37k stars 439 forks source link

Is it possible to manually provide access/refresh token #305

Closed itpropro closed 3 years ago

itpropro commented 3 years ago

There seems to be a problem in the login process with guest accounts that are MSAs: image Therefore, is it possible to directly provide an access/refresh token to the application without going through the login process?

snobu commented 3 years ago

Yes there is, just have your own token acquisition logic update the AccessToken key in .token_cache (it's a JSON file).

The cache file is created by destreamer on first run, you'll need it to populate Gateway URL and version since they are different across MSStream tenants:

Example:

{
    "AccessToken": "eyJ0eXA[snip]",
    "ApiGatewayUri": "https://use2-2.api.microsoftstream.com/api/",
    "ApiGatewayVersion": "1.4-private"
}
snobu commented 3 years ago

By the way, if you have to login to a custom URL just go there and login, destreamer doesn't care, it will simply wait for you to log in then scrape the access token off of the video page you land on.