Refresh token grant
- Last Updated: July 3, 2020
- 1 minute read
- DataDirect Connectors
- JDBC
- Microsoft Sharepoint 6.0
- Documentation
The refresh token grant is used to replace expired access tokens with active ones by exchanging the refresh token at the endpoint specified by the TokenURI property.
Note: As opposed to using a
third-party application such as Postman, you can use the Progress DataDirect SharePoint
Configuration Manager to obtain a refresh token to support the refresh token grant. See
Obtain access and refresh tokens using
the Configuration Manager for details.
To configure the driver to use the refresh token grant:
- Set the ServiceURL property to the URL of the SharePoint site (or "site collection") to which you are connecting. For example, https://mycorp.sharepoint.com/sites/marketing/global.
- Set the ClientID property to specify the client ID key for your application.
- Set the ClientSecret property to specify the client secret for your
application.Important: The client secret is a confidential value used to authenticate the application to the server. To prevent unauthorized access, this value must be securely maintained.
- Set the TokenURI property to specify the endpoint from which the driver fetches access tokens.
- Set the RefreshToken property to specify the refresh token used to
request a new access token or renew an expired one. Important: The refresh token is a confidential value used to authenticate to the server. To prevent unauthorized access, this value must be securely maintained.
The following examples show the connection information required to establish a session using the refresh token grant.
Connection URL
Connection conn = DriverManager.getConnection
("jdbc:datadirect:sharepoint:
ServiceURL=https://mycorp.sharepoint.com/sites/marketing/global;
ClientID=29453d6f-6789-25gh-gd8g-44tk3c527831;
ClientSecret=12a3=bCD/EfGh4Ijk+Lm5P67qR8s=//TuV+WXy1Zabcd;
TokenURI=https://login.microsoftonline.com/common/oauth2/v2.0/token;
RefreshToken=12a3=bCD/EfGh4Ijk+Lgd8g-44tk3c527831;");
Data Source
SharePointDataSource mds = new SharePointDataSource();
mds.setDescription("My SharePoint Data Source");
mds.setServiceURL("https://mycorp.sharepoint.com/sites/marketing/global");
mds.ClientID("29453d6f-6789-25gh-gd8g-44tk3c527831");
mds.ClientSecret("12a3=bCD/EfGh4Ijk+Lm5P67qR8s=//TuV+WXy1Zabcd");
mds.TokenURI("https://login.microsoftonline.com/common/oauth2/v2.0/token");
mds.RefreshToken("12a3=bCD/EfGh4Ijk+Lgd8g-44tk3c527831");