A temporary, light-weight, high-performance solution to get access token of Microsoft Stream without any browser technologies like Chrome/Selenium.
Why you need this? Accroading to the Office 365 roadmap, Microsoft doesn't provide any public APIs to access the Stream videos event you add API permissions to your app. So with the token get by microsoft-stream-auth
, you can access the internal API of Stream, like upload video, download video etc.
The microsoft-stream-auth
go through the login flow by sending HTTP requests. It means it might not work in the feature.
npm install @toolkitx/microsoft-stream-auth
const streamAuth = require('@toolkitx/microsoft-stream-auth');
const result = await streamAuth({account: 'User Account', pwd: 'User Password'});
Then you will get below object:
{
"accessToken": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dC....",
"apiGatewayUri": "https://aaea-1.api.microsoftstream.com/api/",
"apiGatewayVersion": "1.3-private",
"accessTokenExpiry": "2019-12-09T08:19:25.6166735+00:00"
}
- Set your account and password in test/config.js
- Run below command:
npm test