Refresh Token for connection to OneDrive:
In One Drive Plugin Connection Configuration we need to provide connectivity details for a OneDrive instance as mentioned in the table below.
Connection Details:
No.
Field Name
Datatype
Mandatory?
Description
1
Refresh Token
String
Yes
Refresh Token provided by authorization grant flow discussed in sections below.
2
Test Connection
Button
--
Verifies whether the connection is established or not.
Following are the steps for app setup and generating refresh token for OneDrive plugins,
These are discussed below,
https://docs.microsoft.com/en-us/azure/active-directory/develop/reply-url
Permission type |
Mandatory Permission |
Delegated (work or school account) |
offline_access |
https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-register-app#register-an-application
(The following steps are part of Microsoft Graph Code Flow).
Step 1. Get an authorization code
To start the sign-in process with the code flow, use a web browser or web-browser control (Any REST calling tool e.g. Postman, SoupUI, Paw, apidApi, JMeter etc.)
GET https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id={client_id}&scope={scope} &response_type=code
Note: In a place of common can use TenantID also.
Step 2. Redeem the code to fetch refresh token
(access token is also generated along with Refresh token)
POST
https://login.microsoftonline.com/common/oauth2/v2.0/token
Headers:
Content-Type: application/x-www-form-urlencoded
Body: x-www-form-urlencoded (key value pair)
client_id={client_id}
code={code}
grant_type=authorization_code