qua_get_oauth_access_token_d365#

Gets the authentication token used to authenticate to the service.

Beforehand, you may wish to register your own Azure application and use the procedure to obtain its own OAuth credentials.

Syntax#

qua_get_oauth_access_token_d365
    [ @connection_name = ] 'connection_name'
  , [ @callback_url = ] 'callback_url'
  , [ @verifier = ] 'verifier'
  [ , [ @state = ] 'state' ]

Arguments#

[ @connection_name ] - VARCHAR with an existing Dynamics 365 connection name; A value has to reference Dynamics 365 aware service which you are going to authorize your Azure application for.

[ @callback_url ] - VARCHAR; The URL the user will be redirected to after authorizing your application.

[ @verifier ] - VARCHAR; A verifier returned by the service that must be input to return the access token. Obtained by navigating to the URL returned in _qua_get_oauth_authorization_url_d365_.

[ @state ] - NVARCHAR; this field indicates any state that may be useful to your application upon receipt of the response. Your application receives the same value it sent, as this parameter makes a round-trip to Dynamics authorization server and back. Uses include redirecting the user to the correct resource in your site, using nonces, and mitigating cross-site request forgery.

Result Sets#

Column name

Data type

Description

OAuthAccessToken

varchar(max)

The OAuth access token.

*

varchar(2083)

Other outputs that may be returned by the data source.

Permissions#

By default, users with permission Control connection can execute this stored procedure.

Remarks#

Among additional columns in the result set the one which is usually desirable a lot is oauthrefreshtoken. Its value represents the token required to refresh the access token when the one has became expired. To do that you need to set a connection string properties: InitiateOAuth=REFRESH and oauthrefreshtoken the value received.

Example#

EXEC [qua_get_oauth_access_token_d365] 'QueronaDynamicsTechnical', 'http://localhost:33333', 'AQABAAIAAADXzZ3ifr', NULL;

See also#