OAuth 2.0 refresh token grant
- Last Updated: October 5, 2022
- 2 minute read
- DataDirect Connectors
- JDBC
- Microsoft Dynamics 365 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.
This string includes the properties used to connect with OAuth 2.0 authentication.
jdbc:datadirect:dynamics365:ServiceURL=serviceurl;AuthenticationMethod=method;
ClientID=client_id;ClientSecret=client_secret;TokenURI=token_uri;
RefreshToken=refresh_token;[property=value[;...]];
where:
- serviceurl
- specifies the base URL of the Dynamics 365 instance to which you want to issue requests. For example, https://mywebinstance.api.crm.dynamics.com/api/data/v9.1/.
- method
- specifies the authentication method used to connect to the service.
The default value is
OAuth2. SinceOAuth2is the default, this value does not have to be specified in a connection URL used for OAuth 2.0 implementations.
- client_id
- specifies the client ID key for your application when authenticating with OAuth 2.0.
- client_secret
- specifies the client secret for your application when authenticating with OAuth
2.0.
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.
- token_uri
- specifies the endpoint used to exchange authentication credentials for access tokens when OAuth 2.0 authentication is enabled.
- refresh_token
- specifies the refresh token used to either request a new access token or renew an
expired access token.
Important: The refresh token is a confidential value used to authenticate to the server. To prevent unauthorized access, this value must be securely maintained.
- property=value
- specifies connection property settings. Multiple properties are separated by a semi-colon.
The following example connection string includes the properties required for connecting with the OAuth 2.0 refresh token grant.
Connection conn = DriverManager.getConnection
("jdbc:datadirect:dynamics365:
ServiceURL=https://mywebinstance.api.crm.dynamics.com/api/data/v9.1/;
AuthenticationMethod=oauth2;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;");