Custom Credentials
Use a custom OAuth app to authenticate with a user account. The procedures below are specific to normal user accounts, they are not necessary for ISUs because ISUs do not require an interactive login. See Using OAuth Authentication for more information.
Desktop Authentication with a Custom OAuth App
Set the following properties to authenticate with the credentials for a custom OAuth app.
- Set UseWQL, Host, and Tenant as usual.
- InitiateOAuth: Set this to GETANDREFRESH. Use InitiateOAuth to avoid repeating the OAuth exchange and manually setting the OAuthAccessToken.
- OAuthClientId: Set this to the client Id assigned when registering the OAuth app.
- OAuthClientSecret: Set this to the client secret assigned when registering the OAuth app.
When connecting, the driver opens the OAuth endpoint in the default browser. Log in and grant permissions to the application. The driver then completes the OAuth process:
- Extracts the access token from the callback URL and authenticates requests.
- Refreshes the access token when it expires.
- Saves OAuth values in OAuthSettingsLocation to be persisted across connections.
Web Authentication with a Custom OAuth App
When connecting via a Web application, register a custom OAuth app with Workday. Use the driver to get and manage the OAuth token values.
Get an OAuth Access Token
Set the following connection properties to obtain the OAuthAccessToken:
- Set UseWQL, Host, and Tenant as usual.
- OAuthClientId: Set this to the Client Id in the OAuth app settings.
- OAuthClientSecret: Set this to the Client Secret in the OAuth app settings.
Call stored procedures to complete the OAuth exchange:
- Call the GetOAuthAuthorizationURL stored procedure. Set the AuthMode input to WEB and set the CallbackURL input to the Redirect URI specified in the OAuth app settings. The stored procedure returns the URL to the OAuth endpoint.
- Log in and authorize the application. You are redirected back to the callback URL.
- Call the GetOAuthAccessToken stored procedure. Set the AuthMode input to WEB. Set the Verifier input to the "code" parameter in the query string of the callback URL.
Refresh the OAuth Access Token
Set InitiateOAuth to REFRESH to automatically refresh the OAuth access token when it expires, or call the RefreshOAuthAccessToken stored procedure to refresh the token manually.
Automatic Refresh
To refresh the token with InitiateOAuth, set the following on the first data connection:
- Set UseWQL, Host, and Tenant as usual.
- InitiateOAuth: Set this to REFRESH. Use InitiateOAuth to avoid repeating the OAuth exchange and manually setting the OAuthAccessToken.
- OAuthClientId: Set this to the Client Id in the OAuth app settings.
- OAuthClientSecret: Set this to the Client Secret in the OAuth app settings.
- OAuthAccessToken: Set this to the access token returned by GetOAuthAccessToken.
- OAuthRefreshToken: Set this to the refresh token returned by GetOAuthAccessToken.
- OAuthSettingsLocation: Set this to the path where the driver will save the OAuth values, to be persisted across connections.
On subsequent data connections, set the following:
- UseWQL, Host and Tenant
- InitiateOAuth
- OAuthSettingsLocation
Manual Refresh
Use the RefreshOAuthAccessToken stored procedure to manually refresh the OAuthAccessToken. Call the stored procedure after the ExpiresIn parameter value returned by GetOAuthAccessToken has elapsed. It is necessary to set the following connection properties to be set:
- UseWQL: Set this to true.
- Set the UseWQL, Host, and Tenant as usual.
- OAuthClientId: Set this to the Client Id in the OAuth app settings.
- OAuthClientSecret: Set this to the Client Secret in the OAuth app settings.
Call RefreshOAuthAccessToken with the following parameter set:
- OAuthRefreshToken: Set this to the OAuthRefreshToken returned by GetOAuthAccessToken.
Once the new tokens have been retrieved, open a new connection with the following properties set.
- UseWQL: Set this to true.
- Set the Host and Tenant as usual.
- InitiateOAuth
- OAuthAccessToken: Set this to the access token retured from the OAuthRefreshToken procedure.