-
Notifications
You must be signed in to change notification settings - Fork 18
Description
Write tests against arbiter onedrive driver in order to keep it up to date. This test requires browser interaction, so might not be doable with pure scripting.
You will need these variables satisfied:
client_id, tenant_id, redirect_uri, base_url, client_secret, grant_type, and scope="offline_access%20files.read.all%20user.read.all".
The query grant_type will be authorization_code in the first step, and in the refresh step will be refresh_token.
This test will need to hit https://login.microsoftonline.com/common/oauth2/v2.0/authorize with the variables above in the query parameters. This will allow a user to authenticate via oauth with microsoft. Once you've logged in you will be redirected to the url ${redirect_uri}?code=xxxxyyyy&state=12345. Take the code from this url and use it in the next step.
Next you will use that code as the query param code and will hit https://login.microsoftonline.com/common/oauth2/v2.0/token. All other params stay the same. This will return a json response with a refresh_token and access_token key. Parse these two into their own variables and continue.
To refresh you will hit https://login.microsoftonline.com/common/oauth2/v2.0/token, but with the addition of access_token, refresh_token, and grant_type=refresh_token. This will provide the same json response, with access_token and refresh_token keys.
If at any point you have access_token and refresh_token, you can use these config for the onedrive driver. The config must be
"onedrive": {
"access_token": xxxx,
"refresh_token": yyyy,
"client_id": zzzz,
"redirect_uri": aaaa,
"client_secret": bbbb,
"tenant_id": cccc
}
}