Codeunit OAuth2

ID 501
Namespace: System.Security.Authentication

Contains methods supporting authentication via OAuth 2.0 protocol.

Properties

Name Value
Access Public
InherentEntitlements X
InherentPermissions X

Methods

AcquireTokenByAuthorizationCodeWithCertificate

Obsolete

This element will become obsolete from version 24.0. Use AcquireTokenByAuthorizationCodeWithCertificate with SecretText data type for AccessToken.

Gets the authorization token based on the authorization code via the OAuth2 v1.0 code grant flow.

[NonDebuggable]
[TryFunction]
[Obsolete(Use AcquireTokenByAuthorizationCodeWithCertificate with SecretText data type for AccessToken.,24.0)]
procedure AcquireTokenByAuthorizationCodeWithCertificate(ClientId: Text, Certificate: Text, OAuthAuthorityUrl: Text, RedirectURL: Text, ResourceURL: Text, PromptInteraction: Enum "Prompt Interaction", var AccessToken: Text, var AuthCodeErr: Text): Boolean

Parameters

Name Type Description
ClientId Text

The Application (client) ID that the "Azure portal – App registrations" experience assigned to your app.

Certificate Text

The Base64-encoded certificate for the Application (client) configured in the "Azure Portal - Certificates & Secrets".

OAuthAuthorityUrl Text

The identity authorization provider URL.

RedirectURL Text

The redirectURL of your app, where authentication responses can be sent and received by your app. It must exactly match one of the redirectURLs you registered in the portal. If this parameter is empty, the default Business Central URL will be used.

ResourceURL Text

The Application ID of the resource the application is requesting access to. This parameter can be empty.

PromptInteraction System.Security.Authentication."Prompt Interaction"

Indicates the type of user interaction that is required.

AccessToken Text

Exit parameter containing the access token. When this parameter is empty, check the AuthCodeErr for a description of the error.

AuthCodeErr Text

Exit parameter containing the encountered error in the authorization code grant flow. This parameter will be empty in case the token is aquired successfuly.

Returns

Type Description
Boolean

AcquireTokenByAuthorizationCode

Obsolete

This element will become obsolete from version 24.0. Use AcquireTokenByAuthorizationCode with SecretText data type for AccessToken.

[NonDebuggable]
[TryFunction]
[Obsolete(Use AcquireTokenByAuthorizationCode with SecretText data type for AccessToken.,24.0)]
procedure AcquireTokenByAuthorizationCode(ClientId: Text, ClientSecret: Text, OAuthAuthorityUrl: Text, RedirectURL: Text, Scopes: List of [Text], PromptInteraction: Enum "Prompt Interaction", var AccessToken: Text, var AuthCodeErr: Text): Boolean

Parameters

Name Type Description
ClientId Text
ClientSecret Text
OAuthAuthorityUrl Text
RedirectURL Text
Scopes List of [Text]
PromptInteraction System.Security.Authentication."Prompt Interaction"
AccessToken Text
AuthCodeErr Text

Returns

Type Description
Boolean

AcquireTokenByAuthorizationCodeWithCertificate

Obsolete

This element will become obsolete from version 24.0. Use AcquireTokenByAuthorizationCodeWithCertificate with SecretText data type for AccessToken.

[NonDebuggable]
[TryFunction]
[Obsolete(Use AcquireTokenByAuthorizationCodeWithCertificate with SecretText data type for AccessToken.,24.0)]
procedure AcquireTokenByAuthorizationCodeWithCertificate(ClientId: Text, Certificate: Text, OAuthAuthorityUrl: Text, RedirectURL: Text, Scopes: List of [Text], PromptInteraction: Enum "Prompt Interaction", var AccessToken: Text, var AuthCodeErr: Text): Boolean

Parameters

Name Type Description
ClientId Text
Certificate Text
OAuthAuthorityUrl Text
RedirectURL Text
Scopes List of [Text]
PromptInteraction System.Security.Authentication."Prompt Interaction"
AccessToken Text
AuthCodeErr Text

Returns

Type Description
Boolean

AcquireTokensByAuthorizationCode

Obsolete

This element will become obsolete from version 24.0. Use AcquireTokensByAuthorizationCode with SecretText data type for AccessToken.

[NonDebuggable]
[TryFunction]
[Obsolete(Use AcquireTokensByAuthorizationCode with SecretText data type for AccessToken.,24.0)]
procedure AcquireTokensByAuthorizationCode(ClientId: Text, ClientSecret: Text, OAuthAuthorityUrl: Text, RedirectURL: Text, Scopes: List of [Text], PromptInteraction: Enum "Prompt Interaction", var AccessToken: Text, var IdToken: Text, var AuthCodeErr: Text): Boolean

Parameters

Name Type Description
ClientId Text
ClientSecret Text
OAuthAuthorityUrl Text
RedirectURL Text
Scopes List of [Text]
PromptInteraction System.Security.Authentication."Prompt Interaction"
AccessToken Text
IdToken Text
AuthCodeErr Text

Returns

Type Description
Boolean

AcquireTokensByAuthorizationCodeWithCertificate

Obsolete

This element will become obsolete from version 24.0. Use AcquireTokensByAuthorizationCodeWithCertificate with SecretText data type for AccessToken.

[NonDebuggable]
[TryFunction]
[Obsolete(Use AcquireTokensByAuthorizationCodeWithCertificate with SecretText data type for AccessToken.,24.0)]
procedure AcquireTokensByAuthorizationCodeWithCertificate(ClientId: Text, Certificate: Text, OAuthAuthorityUrl: Text, RedirectURL: Text, Scopes: List of [Text], PromptInteraction: Enum "Prompt Interaction", var AccessToken: Text, var IdToken: Text, var AuthCodeErr: Text): Boolean

Parameters

Name Type Description
ClientId Text
Certificate Text
OAuthAuthorityUrl Text
RedirectURL Text
Scopes List of [Text]
PromptInteraction System.Security.Authentication."Prompt Interaction"
AccessToken Text
IdToken Text
AuthCodeErr Text

Returns

Type Description
Boolean

AcquireTokenAndTokenCacheByAuthorizationCode

Obsolete

This element will become obsolete from version 24.0. Use AcquireTokenAndTokenCacheByAuthorizationCode with SecretText data type for AccessToken.

[NonDebuggable]
[TryFunction]
[Obsolete(Use AcquireTokenAndTokenCacheByAuthorizationCode with SecretText data type for AccessToken.,24.0)]
procedure AcquireTokenAndTokenCacheByAuthorizationCode(ClientId: Text, ClientSecret: Text, OAuthAuthorityUrl: Text, RedirectURL: Text, Scopes: List of [Text], PromptInteraction: Enum "Prompt Interaction", var AccessToken: Text, var TokenCache: Text, var Error: Text): Boolean

Parameters

Name Type Description
ClientId Text
ClientSecret Text
OAuthAuthorityUrl Text
RedirectURL Text
Scopes List of [Text]
PromptInteraction System.Security.Authentication."Prompt Interaction"
AccessToken Text
TokenCache Text
Error Text

Returns

Type Description
Boolean

AcquireTokenAndTokenCacheByAuthorizationCodeWithCertificate

Obsolete

This element will become obsolete from version 24.0. Use AcquireTokenAndTokenCacheByAuthorizationCodeWithCertificate with SecretText data type for AccessToken.

[NonDebuggable]
[TryFunction]
[Obsolete(Use AcquireTokenAndTokenCacheByAuthorizationCodeWithCertificate with SecretText data type for AccessToken.,24.0)]
procedure AcquireTokenAndTokenCacheByAuthorizationCodeWithCertificate(ClientId: Text, Certificate: Text, OAuthAuthorityUrl: Text, RedirectURL: Text, Scopes: List of [Text], PromptInteraction: Enum "Prompt Interaction", var AccessToken: Text, var TokenCache: Text, var Error: Text): Boolean

Parameters

Name Type Description
ClientId Text
Certificate Text
OAuthAuthorityUrl Text
RedirectURL Text
Scopes List of [Text]
PromptInteraction System.Security.Authentication."Prompt Interaction"
AccessToken Text
TokenCache Text
Error Text

Returns

Type Description
Boolean

AcquireTokensAndTokenCacheByAuthorizationCode

Obsolete

This element will become obsolete from version 24.0. Use AcquireTokensAndTokenCacheByAuthorizationCode with SecretText data type for AccessToken.

[NonDebuggable]
[TryFunction]
[Obsolete(Use AcquireTokensAndTokenCacheByAuthorizationCode with SecretText data type for AccessToken.,24.0)]
procedure AcquireTokensAndTokenCacheByAuthorizationCode(ClientId: Text, ClientSecret: Text, OAuthAuthorityUrl: Text, RedirectURL: Text, Scopes: List of [Text], PromptInteraction: Enum "Prompt Interaction", var AccessToken: Text, var IdToken: Text, var TokenCache: Text, var Error: Text): Boolean

Parameters

Name Type Description
ClientId Text
ClientSecret Text
OAuthAuthorityUrl Text
RedirectURL Text
Scopes List of [Text]
PromptInteraction System.Security.Authentication."Prompt Interaction"
AccessToken Text
IdToken Text
TokenCache Text
Error Text

Returns

Type Description
Boolean

AcquireTokensAndTokenCacheByAuthorizationCodeWithCertificate

Obsolete

This element will become obsolete from version 24.0. Use AcquireTokensAndTokenCacheByAuthorizationCodeWithCertificate with SecretText data type for AccessToken.

[NonDebuggable]
[TryFunction]
[Obsolete(Use AcquireTokensAndTokenCacheByAuthorizationCodeWithCertificate with SecretText data type for AccessToken.,24.0)]
procedure AcquireTokensAndTokenCacheByAuthorizationCodeWithCertificate(ClientId: Text, Certificate: Text, OAuthAuthorityUrl: Text, RedirectURL: Text, Scopes: List of [Text], PromptInteraction: Enum "Prompt Interaction", var AccessToken: Text, var IdToken: Text, var TokenCache: Text, var Error: Text): Boolean

Parameters

Name Type Description
ClientId Text
Certificate Text
OAuthAuthorityUrl Text
RedirectURL Text
Scopes List of [Text]
PromptInteraction System.Security.Authentication."Prompt Interaction"
AccessToken Text
IdToken Text
TokenCache Text
Error Text

Returns

Type Description
Boolean

AcquireTokenWithClientCredentials

Obsolete

This element will become obsolete from version 24.0. Use AcquireTokenWithClientCredentials with SecretText data type for AccessToken.

Gets the access token via the Client Credentials OAuth2 v1.0 grant flow.

[NonDebuggable]
[TryFunction]
[Obsolete(Use AcquireTokenWithClientCredentials with SecretText data type for AccessToken.,24.0)]
procedure AcquireTokenWithClientCredentials(ClientId: Text, ClientSecret: Text, OAuthAuthorityUrl: Text, RedirectURL: Text, ResourceURL: Text, var AccessToken: Text): Boolean

Parameters

Name Type Description
ClientId Text

The Application (client) ID that the Azure portal – App registrations experience assigned to your app.

ClientSecret Text

The Application (client) secret configured in the Azure Portal - Certificates & Secrets.

OAuthAuthorityUrl Text

The identity authorization provider URL.

RedirectURL Text

The redirectURL of your app, where authentication responses can be sent and received by your app. It must exactly match one of the redirectURLs you registered in the portal. If this parameter is empty, the default Business Central URL will be used.

ResourceURL Text

The Application ID of the resource the application is requesting access to. This parameter can be empty.

AccessToken Text

Exit parameter containing the access token.

Returns

Type Description
Boolean

AcquireTokenWithClientCredentials

Obsolete

This element will become obsolete from version 24.0. Use AcquireTokenWithClientCredentials with SecretText data type for AccessToken.

[NonDebuggable]
[TryFunction]
[Obsolete(Use AcquireTokenWithClientCredentials with SecretText data type for AccessToken.,24.0)]
procedure AcquireTokenWithClientCredentials(ClientId: Text, ClientSecret: Text, OAuthAuthorityUrl: Text, RedirectURL: Text, Scopes: List of [Text], var AccessToken: Text): Boolean

Parameters

Name Type Description
ClientId Text
ClientSecret Text
OAuthAuthorityUrl Text
RedirectURL Text
Scopes List of [Text]
AccessToken Text

Returns

Type Description
Boolean

AcquireAuthorizationCodeTokenFromCacheWithCertificate

Obsolete

This element will become obsolete from version 24.0. Use AcquireAuthorizationCodeTokenFromCacheWithCertificate with SecretText data type for AccessToken.

Gets the access token from cache or a refreshed token via OAuth2 v1.0 protocol.

[NonDebuggable]
[TryFunction]
[Obsolete(Use AcquireAuthorizationCodeTokenFromCacheWithCertificate with SecretText data type for AccessToken.,24.0)]
procedure AcquireAuthorizationCodeTokenFromCacheWithCertificate(ClientId: Text, Certificate: Text, RedirectURL: Text, OAuthAuthorityUrl: Text, ResourceURL: Text, var AccessToken: Text): Boolean

Parameters

Name Type Description
ClientId Text

The Application (client) ID that the Azure portal – App registrations experience assigned to your app.

Certificate Text

The Base64-encoded certificate for the Application (client) configured in the Azure Portal - Certificates & Secrets.

RedirectURL Text

The redirectURL of your app, where authentication responses can be sent and received by your app. It must exactly match one of the redirectURLs you registered in the portal. If this parameter is empty, the default Business Central URL will be used.

OAuthAuthorityUrl Text

The identity authorization provider URL.

ResourceURL Text

The Application ID of the resource the application is requesting access to. This parameter can be empty.

AccessToken Text

Exit parameter containing the access token.

Returns

Type Description
Boolean

AcquireAuthorizationCodeTokenFromCache

Obsolete

This element will become obsolete from version 24.0. Use AcquireAuthorizationCodeTokenFromCache with SecretText data type for AccessToken.

[NonDebuggable]
[TryFunction]
[Obsolete(Use AcquireAuthorizationCodeTokenFromCache with SecretText data type for AccessToken.,24.0)]
procedure AcquireAuthorizationCodeTokenFromCache(ClientId: Text, ClientSecret: Text, RedirectURL: Text, OAuthAuthorityUrl: Text, Scopes: List of [Text], var AccessToken: Text): Boolean

Parameters

Name Type Description
ClientId Text
ClientSecret Text
RedirectURL Text
OAuthAuthorityUrl Text
Scopes List of [Text]
AccessToken Text

Returns

Type Description
Boolean

AcquireTokensFromCache

Obsolete

This element will become obsolete from version 24.0. Use AcquireTokensFromCache with SecretText data type for AccessToken.

[NonDebuggable]
[TryFunction]
[Obsolete(Use AcquireTokensFromCache with SecretText data type for AccessToken.,24.0)]
procedure AcquireTokensFromCache(ClientId: Text, ClientSecret: Text, RedirectURL: Text, OAuthAuthorityUrl: Text, Scopes: List of [Text], var AccessToken: Text, var IdToken: Text): Boolean

Parameters

Name Type Description
ClientId Text
ClientSecret Text
RedirectURL Text
OAuthAuthorityUrl Text
Scopes List of [Text]
AccessToken Text
IdToken Text

Returns

Type Description
Boolean

AcquireAuthorizationCodeTokenFromCacheWithCertificate

Obsolete

This element will become obsolete from version 24.0. Use AcquireAuthorizationCodeTokenFromCacheWithCertificate with SecretText data type for AccessToken.

[NonDebuggable]
[TryFunction]
[Obsolete(Use AcquireAuthorizationCodeTokenFromCacheWithCertificate with SecretText data type for AccessToken.,24.0)]
procedure AcquireAuthorizationCodeTokenFromCacheWithCertificate(ClientId: Text, Certificate: Text, RedirectURL: Text, OAuthAuthorityUrl: Text, Scopes: List of [Text], var AccessToken: Text): Boolean

Parameters

Name Type Description
ClientId Text
Certificate Text
RedirectURL Text
OAuthAuthorityUrl Text
Scopes List of [Text]
AccessToken Text

Returns

Type Description
Boolean

AcquireTokensFromCacheWithCertificate

Obsolete

This element will become obsolete from version 24.0. Use AcquireTokensFromCacheWithCertificate with SecretText data type for AccessToken.

[NonDebuggable]
[TryFunction]
[Obsolete(Use AcquireTokensFromCacheWithCertificate with SecretText data type for AccessToken.,24.0)]
procedure AcquireTokensFromCacheWithCertificate(ClientId: Text, Certificate: Text, RedirectURL: Text, OAuthAuthorityUrl: Text, Scopes: List of [Text], var AccessToken: Text, var IdToken: Text): Boolean

Parameters

Name Type Description
ClientId Text
Certificate Text
RedirectURL Text
OAuthAuthorityUrl Text
Scopes List of [Text]
AccessToken Text
IdToken Text

Returns

Type Description
Boolean

AcquireTokensWithCertificate

Obsolete

This element will become obsolete from version 24.0. Use AcquireTokensWithCertificate with SecretText data type for AccessToken.

[NonDebuggable]
[TryFunction]
[Obsolete(Use AcquireTokensWithCertificate with SecretText data type for AccessToken.,24.0)]
procedure AcquireTokensWithCertificate(ClientId: Text, Certificate: Text, RedirectURL: Text, OAuthAuthorityUrl: Text, Scopes: List of [Text], var AccessToken: Text, var IdToken: Text): Boolean

Parameters

Name Type Description
ClientId Text
Certificate Text
RedirectURL Text
OAuthAuthorityUrl Text
Scopes List of [Text]
AccessToken Text
IdToken Text

Returns

Type Description
Boolean

AcquireOnBehalfOfTokenByTokenCache

Obsolete

This element will become obsolete from version 24.0. Use AcquireOnBehalfOfTokenByTokenCache with SecretText data type for AccessToken.

[NonDebuggable]
[TryFunction]
[Obsolete(Use AcquireOnBehalfOfTokenByTokenCache with SecretText data type for AccessToken.,24.0)]
procedure AcquireOnBehalfOfTokenByTokenCache(ClientId: Text, ClientSecret: Text, LoginHint: Text, RedirectURL: Text, Scopes: List of [Text], TokenCache: Text, var AccessToken: Text, var NewTokenCache: Text): Boolean

Parameters

Name Type Description
ClientId Text
ClientSecret Text
LoginHint Text
RedirectURL Text
Scopes List of [Text]
TokenCache Text
AccessToken Text
NewTokenCache Text

Returns

Type Description
Boolean

AcquireOnBehalfOfTokensByTokenCache

Obsolete

This element will become obsolete from version 24.0. Use AcquireOnBehalfOfTokensByTokenCache with SecretText data type for AccessToken.

[NonDebuggable]
[TryFunction]
[Obsolete(Use AcquireOnBehalfOfTokensByTokenCache with SecretText data type for AccessToken.,24.0)]
procedure AcquireOnBehalfOfTokensByTokenCache(ClientId: Text, ClientSecret: Text, LoginHint: Text, RedirectURL: Text, Scopes: List of [Text], TokenCache: Text, var AccessToken: Text, var IdToken: Text, var NewTokenCache: Text): Boolean

Parameters

Name Type Description
ClientId Text
ClientSecret Text
LoginHint Text
RedirectURL Text
Scopes List of [Text]
TokenCache Text
AccessToken Text
IdToken Text
NewTokenCache Text

Returns

Type Description
Boolean

AcquireTokenByAuthorizationCodeWithCertificate

Gets the authorization token based on the authorization code via the OAuth2 v1.0 code grant flow.

[TryFunction]
procedure AcquireTokenByAuthorizationCodeWithCertificate(ClientId: Text, Certificate: Text, OAuthAuthorityUrl: Text, RedirectURL: Text, ResourceURL: Text, PromptInteraction: Enum "Prompt Interaction", var AccessToken: SecretText, var AuthCodeErr: Text): Boolean

Parameters

Name Type Description
ClientId Text

The Application (client) ID that the "Azure portal – App registrations" experience assigned to your app.

Certificate Text

The Base64-encoded certificate for the Application (client) configured in the "Azure Portal - Certificates & Secrets".

OAuthAuthorityUrl Text

The identity authorization provider URL.

RedirectURL Text

The redirectURL of your app, where authentication responses can be sent and received by your app. It must exactly match one of the redirectURLs you registered in the portal. If this parameter is empty, the default Business Central URL will be used.

ResourceURL Text

The Application ID of the resource the application is requesting access to. This parameter can be empty.

PromptInteraction System.Security.Authentication."Prompt Interaction"

Indicates the type of user interaction that is required.

AccessToken SecretText

Exit parameter containing the access token. When this parameter is empty, check the AuthCodeErr for a description of the error.

AuthCodeErr Text

Exit parameter containing the encountered error in the authorization code grant flow. This parameter will be empty in case the token is aquired successfuly.

Returns

Type Description
Boolean

AcquireTokenByAuthorizationCodeWithCertificate

Gets the authorization token based on the authorization code via the OAuth2 v1.0 code grant flow.

[TryFunction]
procedure AcquireTokenByAuthorizationCodeWithCertificate(ClientId: Text, Certificate: Text, CertificatePassword: SecretText, OAuthAuthorityUrl: Text, RedirectURL: Text, ResourceURL: Text, PromptInteraction: Enum "Prompt Interaction", var AccessToken: SecretText, var AuthCodeErr: Text): Boolean

Parameters

Name Type Description
ClientId Text

The Application (client) ID that the "Azure portal – App registrations" experience assigned to your app.

Certificate Text

The Base64-encoded certificate for the Application (client) configured in the "Azure Portal - Certificates & Secrets".

CertificatePassword SecretText

Password for the certificate.

OAuthAuthorityUrl Text

The identity authorization provider URL.

RedirectURL Text

The redirectURL of your app, where authentication responses can be sent and received by your app. It must exactly match one of the redirectURLs you registered in the portal. If this parameter is empty, the default Business Central URL will be used.

ResourceURL Text

The Application ID of the resource the application is requesting access to. This parameter can be empty.

PromptInteraction System.Security.Authentication."Prompt Interaction"

Indicates the type of user interaction that is required.

AccessToken SecretText

Exit parameter containing the access token. When this parameter is empty, check the AuthCodeErr for a description of the error.

AuthCodeErr Text

Exit parameter containing the encountered error in the authorization code grant flow. This parameter will be empty in case the token is aquired successfuly.

Returns

Type Description
Boolean

AcquireTokenByAuthorizationCode

[TryFunction]
procedure AcquireTokenByAuthorizationCode(ClientId: Text, ClientSecret: SecretText, OAuthAuthorityUrl: Text, RedirectURL: Text, Scopes: List of [Text], PromptInteraction: Enum "Prompt Interaction", var AccessToken: SecretText, var AuthCodeErr: Text): Boolean

Parameters

Name Type Description
ClientId Text
ClientSecret SecretText
OAuthAuthorityUrl Text
RedirectURL Text
Scopes List of [Text]
PromptInteraction System.Security.Authentication."Prompt Interaction"
AccessToken SecretText
AuthCodeErr Text

Returns

Type Description
Boolean

AcquireTokenByAuthorizationCodeWithCertificate

[TryFunction]
procedure AcquireTokenByAuthorizationCodeWithCertificate(ClientId: Text, Certificate: Text, OAuthAuthorityUrl: Text, RedirectURL: Text, Scopes: List of [Text], PromptInteraction: Enum "Prompt Interaction", var AccessToken: SecretText, var AuthCodeErr: Text): Boolean

Parameters

Name Type Description
ClientId Text
Certificate Text
OAuthAuthorityUrl Text
RedirectURL Text
Scopes List of [Text]
PromptInteraction System.Security.Authentication."Prompt Interaction"
AccessToken SecretText
AuthCodeErr Text

Returns

Type Description
Boolean

AcquireTokenByAuthorizationCodeWithCertificate

[TryFunction]
procedure AcquireTokenByAuthorizationCodeWithCertificate(ClientId: Text, Certificate: Text, CertificatePassword: SecretText, OAuthAuthorityUrl: Text, RedirectURL: Text, Scopes: List of [Text], PromptInteraction: Enum "Prompt Interaction", var AccessToken: SecretText, var AuthCodeErr: Text): Boolean

Parameters

Name Type Description
ClientId Text
Certificate Text
CertificatePassword SecretText
OAuthAuthorityUrl Text
RedirectURL Text
Scopes List of [Text]
PromptInteraction System.Security.Authentication."Prompt Interaction"
AccessToken SecretText
AuthCodeErr Text

Returns

Type Description
Boolean

AcquireTokensByAuthorizationCode

[TryFunction]
procedure AcquireTokensByAuthorizationCode(ClientId: Text, ClientSecret: SecretText, OAuthAuthorityUrl: Text, RedirectURL: Text, Scopes: List of [Text], PromptInteraction: Enum "Prompt Interaction", var AccessToken: SecretText, var IdToken: Text, var AuthCodeErr: Text): Boolean

Parameters

Name Type Description
ClientId Text
ClientSecret SecretText
OAuthAuthorityUrl Text
RedirectURL Text
Scopes List of [Text]
PromptInteraction System.Security.Authentication."Prompt Interaction"
AccessToken SecretText
IdToken Text
AuthCodeErr Text

Returns

Type Description
Boolean

AcquireTokensByAuthorizationCodeWithCertificate

[TryFunction]
procedure AcquireTokensByAuthorizationCodeWithCertificate(ClientId: Text, Certificate: Text, OAuthAuthorityUrl: Text, RedirectURL: Text, Scopes: List of [Text], PromptInteraction: Enum "Prompt Interaction", var AccessToken: SecretText, var IdToken: Text, var AuthCodeErr: Text): Boolean

Parameters

Name Type Description
ClientId Text
Certificate Text
OAuthAuthorityUrl Text
RedirectURL Text
Scopes List of [Text]
PromptInteraction System.Security.Authentication."Prompt Interaction"
AccessToken SecretText
IdToken Text
AuthCodeErr Text

Returns

Type Description
Boolean

AcquireTokensByAuthorizationCodeWithCertificate

[TryFunction]
procedure AcquireTokensByAuthorizationCodeWithCertificate(ClientId: Text, Certificate: Text, CertificatePassword: SecretText, OAuthAuthorityUrl: Text, RedirectURL: Text, Scopes: List of [Text], PromptInteraction: Enum "Prompt Interaction", var AccessToken: SecretText, var IdToken: Text, var AuthCodeErr: Text): Boolean

Parameters

Name Type Description
ClientId Text
Certificate Text
CertificatePassword SecretText
OAuthAuthorityUrl Text
RedirectURL Text
Scopes List of [Text]
PromptInteraction System.Security.Authentication."Prompt Interaction"
AccessToken SecretText
IdToken Text
AuthCodeErr Text

Returns

Type Description
Boolean

AcquireTokenAndTokenCacheByAuthorizationCode

[TryFunction]
procedure AcquireTokenAndTokenCacheByAuthorizationCode(ClientId: Text, ClientSecret: SecretText, OAuthAuthorityUrl: Text, RedirectURL: Text, Scopes: List of [Text], PromptInteraction: Enum "Prompt Interaction", var AccessToken: SecretText, var TokenCache: Text, var Error: Text): Boolean

Parameters

Name Type Description
ClientId Text
ClientSecret SecretText
OAuthAuthorityUrl Text
RedirectURL Text
Scopes List of [Text]
PromptInteraction System.Security.Authentication."Prompt Interaction"
AccessToken SecretText
TokenCache Text
Error Text

Returns

Type Description
Boolean

AcquireTokenAndTokenCacheByAuthorizationCodeWithCertificate

[TryFunction]
procedure AcquireTokenAndTokenCacheByAuthorizationCodeWithCertificate(ClientId: Text, Certificate: Text, OAuthAuthorityUrl: Text, RedirectURL: Text, Scopes: List of [Text], PromptInteraction: Enum "Prompt Interaction", var AccessToken: SecretText, var TokenCache: Text, var Error: Text): Boolean

Parameters

Name Type Description
ClientId Text
Certificate Text
OAuthAuthorityUrl Text
RedirectURL Text
Scopes List of [Text]
PromptInteraction System.Security.Authentication."Prompt Interaction"
AccessToken SecretText
TokenCache Text
Error Text

Returns

Type Description
Boolean

AcquireTokenAndTokenCacheByAuthorizationCodeWithCertificate

[TryFunction]
procedure AcquireTokenAndTokenCacheByAuthorizationCodeWithCertificate(ClientId: Text, Certificate: Text, CertificatePassword: SecretText, OAuthAuthorityUrl: Text, RedirectURL: Text, Scopes: List of [Text], PromptInteraction: Enum "Prompt Interaction", var AccessToken: SecretText, var TokenCache: Text, var Error: Text): Boolean

Parameters

Name Type Description
ClientId Text
Certificate Text
CertificatePassword SecretText
OAuthAuthorityUrl Text
RedirectURL Text
Scopes List of [Text]
PromptInteraction System.Security.Authentication."Prompt Interaction"
AccessToken SecretText
TokenCache Text
Error Text

Returns

Type Description
Boolean

AcquireTokensAndTokenCacheByAuthorizationCode

[TryFunction]
procedure AcquireTokensAndTokenCacheByAuthorizationCode(ClientId: Text, ClientSecret: SecretText, OAuthAuthorityUrl: Text, RedirectURL: Text, Scopes: List of [Text], PromptInteraction: Enum "Prompt Interaction", var AccessToken: SecretText, var IdToken: Text, var TokenCache: Text, var Error: Text): Boolean

Parameters

Name Type Description
ClientId Text
ClientSecret SecretText
OAuthAuthorityUrl Text
RedirectURL Text
Scopes List of [Text]
PromptInteraction System.Security.Authentication."Prompt Interaction"
AccessToken SecretText
IdToken Text
TokenCache Text
Error Text

Returns

Type Description
Boolean

AcquireTokensAndTokenCacheByAuthorizationCodeWithCertificate

[TryFunction]
procedure AcquireTokensAndTokenCacheByAuthorizationCodeWithCertificate(ClientId: Text, Certificate: Text, OAuthAuthorityUrl: Text, RedirectURL: Text, Scopes: List of [Text], PromptInteraction: Enum "Prompt Interaction", var AccessToken: SecretText, var IdToken: Text, var TokenCache: Text, var Error: Text): Boolean

Parameters

Name Type Description
ClientId Text
Certificate Text
OAuthAuthorityUrl Text
RedirectURL Text
Scopes List of [Text]
PromptInteraction System.Security.Authentication."Prompt Interaction"
AccessToken SecretText
IdToken Text
TokenCache Text
Error Text

Returns

Type Description
Boolean

AcquireTokensAndTokenCacheByAuthorizationCodeWithCertificate

[TryFunction]
procedure AcquireTokensAndTokenCacheByAuthorizationCodeWithCertificate(ClientId: Text, Certificate: Text, CertificatePassword: SecretText, OAuthAuthorityUrl: Text, RedirectURL: Text, Scopes: List of [Text], PromptInteraction: Enum "Prompt Interaction", var AccessToken: SecretText, var IdToken: Text, var TokenCache: Text, var Error: Text): Boolean

Parameters

Name Type Description
ClientId Text
Certificate Text
CertificatePassword SecretText
OAuthAuthorityUrl Text
RedirectURL Text
Scopes List of [Text]
PromptInteraction System.Security.Authentication."Prompt Interaction"
AccessToken SecretText
IdToken Text
TokenCache Text
Error Text

Returns

Type Description
Boolean

RequestClientCredentialsAdminPermissions

Request the permissions from a directory admin.

[TryFunction]
procedure RequestClientCredentialsAdminPermissions(ClientId: Text, OAuthAuthorityUrl: Text, RedirectURL: Text, var HasGrantConsentSucceeded: Boolean, var PermissionGrantError: Text): Boolean

Parameters

Name Type Description
ClientId Text

The Application (client) ID that the Azure portal – App registrations experience assigned to your app.

OAuthAuthorityUrl Text

The identity authorization provider URL.

RedirectURL Text

The redirectURL of your app, where authentication responses can be sent and received by your app. It must exactly match one of the redirectURLs you registered in the portal. If this parameter is empty, the default Business Central URL will be used.

HasGrantConsentSucceeded Boolean

Exit parameter indicating the success of granting application permissions.

PermissionGrantError Text

Exit parameter containing the encountered error in the application permissions grant. This parameter will be empty in case the flow is completed successfuly.

Returns

Type Description
Boolean

AcquireTokenWithClientCredentials

Gets the access token via the Client Credentials OAuth2 v1.0 grant flow.

[TryFunction]
procedure AcquireTokenWithClientCredentials(ClientId: Text, ClientSecret: SecretText, OAuthAuthorityUrl: Text, RedirectURL: Text, ResourceURL: Text, var AccessToken: SecretText): Boolean

Parameters

Name Type Description
ClientId Text

The Application (client) ID that the Azure portal – App registrations experience assigned to your app.

ClientSecret SecretText

The Application (client) secret configured in the Azure Portal - Certificates & Secrets.

OAuthAuthorityUrl Text

The identity authorization provider URL.

RedirectURL Text

The redirectURL of your app, where authentication responses can be sent and received by your app. It must exactly match one of the redirectURLs you registered in the portal. If this parameter is empty, the default Business Central URL will be used.

ResourceURL Text

The Application ID of the resource the application is requesting access to. This parameter can be empty.

AccessToken SecretText

Exit parameter containing the access token.

Returns

Type Description
Boolean

AcquireTokenWithClientCredentials

[TryFunction]
procedure AcquireTokenWithClientCredentials(ClientId: Text, ClientSecret: SecretText, OAuthAuthorityUrl: Text, RedirectURL: Text, Scopes: List of [Text], var AccessToken: SecretText): Boolean

Parameters

Name Type Description
ClientId Text
ClientSecret SecretText
OAuthAuthorityUrl Text
RedirectURL Text
Scopes List of [Text]
AccessToken SecretText

Returns

Type Description
Boolean

AcquireAuthorizationCodeTokenFromCacheWithCertificate

Gets the access token from cache or a refreshed token via OAuth2 v1.0 protocol.

[TryFunction]
procedure AcquireAuthorizationCodeTokenFromCacheWithCertificate(ClientId: Text, Certificate: Text, RedirectURL: Text, OAuthAuthorityUrl: Text, ResourceURL: Text, var AccessToken: SecretText): Boolean

Parameters

Name Type Description
ClientId Text

The Application (client) ID that the Azure portal – App registrations experience assigned to your app.

Certificate Text

The Base64-encoded certificate for the Application (client) configured in the Azure Portal - Certificates & Secrets.

RedirectURL Text

The redirectURL of your app, where authentication responses can be sent and received by your app. It must exactly match one of the redirectURLs you registered in the portal. If this parameter is empty, the default Business Central URL will be used.

OAuthAuthorityUrl Text

The identity authorization provider URL.

ResourceURL Text

The Application ID of the resource the application is requesting access to. This parameter can be empty.

AccessToken SecretText

Exit parameter containing the access token.

Returns

Type Description
Boolean

AcquireAuthorizationCodeTokenFromCacheWithCertificate

Gets the access token from cache or a refreshed token via OAuth2 v1.0 protocol.

[TryFunction]
procedure AcquireAuthorizationCodeTokenFromCacheWithCertificate(ClientId: Text, Certificate: Text, CertificatePassword: SecretText, RedirectURL: Text, OAuthAuthorityUrl: Text, ResourceURL: Text, var AccessToken: SecretText): Boolean

Parameters

Name Type Description
ClientId Text

The Application (client) ID that the Azure portal – App registrations experience assigned to your app.

Certificate Text

The Base64-encoded certificate for the Application (client) configured in the Azure Portal - Certificates & Secrets.

CertificatePassword SecretText

Password for the certificate.

RedirectURL Text

The redirectURL of your app, where authentication responses can be sent and received by your app. It must exactly match one of the redirectURLs you registered in the portal. If this parameter is empty, the default Business Central URL will be used.

OAuthAuthorityUrl Text

The identity authorization provider URL.

ResourceURL Text

The Application ID of the resource the application is requesting access to. This parameter can be empty.

AccessToken SecretText

Exit parameter containing the access token.

Returns

Type Description
Boolean

AcquireAuthorizationCodeTokenFromCache

[TryFunction]
procedure AcquireAuthorizationCodeTokenFromCache(ClientId: Text, ClientSecret: SecretText, RedirectURL: Text, OAuthAuthorityUrl: Text, Scopes: List of [Text], var AccessToken: SecretText): Boolean

Parameters

Name Type Description
ClientId Text
ClientSecret SecretText
RedirectURL Text
OAuthAuthorityUrl Text
Scopes List of [Text]
AccessToken SecretText

Returns

Type Description
Boolean

AcquireTokensFromCache

[TryFunction]
procedure AcquireTokensFromCache(ClientId: Text, ClientSecret: SecretText, RedirectURL: Text, OAuthAuthorityUrl: Text, Scopes: List of [Text], var AccessToken: SecretText, var IdToken: Text): Boolean

Parameters

Name Type Description
ClientId Text
ClientSecret SecretText
RedirectURL Text
OAuthAuthorityUrl Text
Scopes List of [Text]
AccessToken SecretText
IdToken Text

Returns

Type Description
Boolean

AcquireAuthorizationCodeTokenFromCacheWithCertificate

[TryFunction]
procedure AcquireAuthorizationCodeTokenFromCacheWithCertificate(ClientId: Text, Certificate: Text, RedirectURL: Text, OAuthAuthorityUrl: Text, Scopes: List of [Text], var AccessToken: SecretText): Boolean

Parameters

Name Type Description
ClientId Text
Certificate Text
RedirectURL Text
OAuthAuthorityUrl Text
Scopes List of [Text]
AccessToken SecretText

Returns

Type Description
Boolean

AcquireAuthorizationCodeTokenFromCacheWithCertificate

[TryFunction]
procedure AcquireAuthorizationCodeTokenFromCacheWithCertificate(ClientId: Text, Certificate: Text, CertificatePassword: SecretText, RedirectURL: Text, OAuthAuthorityUrl: Text, Scopes: List of [Text], var AccessToken: SecretText): Boolean

Parameters

Name Type Description
ClientId Text
Certificate Text
CertificatePassword SecretText
RedirectURL Text
OAuthAuthorityUrl Text
Scopes List of [Text]
AccessToken SecretText

Returns

Type Description
Boolean

AcquireTokensFromCacheWithCertificate

[TryFunction]
procedure AcquireTokensFromCacheWithCertificate(ClientId: Text, Certificate: Text, RedirectURL: Text, OAuthAuthorityUrl: Text, Scopes: List of [Text], var AccessToken: SecretText, var IdToken: Text): Boolean

Parameters

Name Type Description
ClientId Text
Certificate Text
RedirectURL Text
OAuthAuthorityUrl Text
Scopes List of [Text]
AccessToken SecretText
IdToken Text

Returns

Type Description
Boolean

AcquireTokensFromCacheWithCertificate

[TryFunction]
procedure AcquireTokensFromCacheWithCertificate(ClientId: Text, Certificate: Text, CertificatePassword: SecretText, RedirectURL: Text, OAuthAuthorityUrl: Text, Scopes: List of [Text], var AccessToken: SecretText, var IdToken: Text): Boolean

Parameters

Name Type Description
ClientId Text
Certificate Text
CertificatePassword SecretText
RedirectURL Text
OAuthAuthorityUrl Text
Scopes List of [Text]
AccessToken SecretText
IdToken Text

Returns

Type Description
Boolean

AcquireTokensWithCertificate

[TryFunction]
procedure AcquireTokensWithCertificate(ClientId: Text, Certificate: Text, RedirectURL: Text, OAuthAuthorityUrl: Text, Scopes: List of [Text], var AccessToken: SecretText, var IdToken: Text): Boolean

Parameters

Name Type Description
ClientId Text
Certificate Text
RedirectURL Text
OAuthAuthorityUrl Text
Scopes List of [Text]
AccessToken SecretText
IdToken Text

Returns

Type Description
Boolean

AcquireTokensWithCertificate

[TryFunction]
procedure AcquireTokensWithCertificate(ClientId: Text, Certificate: Text, CertificatePassword: SecretText, RedirectURL: Text, OAuthAuthorityUrl: Text, Scopes: List of [Text], var AccessToken: SecretText, var IdToken: Text): Boolean

Parameters

Name Type Description
ClientId Text
Certificate Text
CertificatePassword SecretText
RedirectURL Text
OAuthAuthorityUrl Text
Scopes List of [Text]
AccessToken SecretText
IdToken Text

Returns

Type Description
Boolean

AcquireOnBehalfOfTokenByTokenCache

[TryFunction]
procedure AcquireOnBehalfOfTokenByTokenCache(ClientId: Text, ClientSecret: SecretText, LoginHint: Text, RedirectURL: Text, Scopes: List of [Text], TokenCache: Text, var AccessToken: SecretText, var NewTokenCache: Text): Boolean

Parameters

Name Type Description
ClientId Text
ClientSecret SecretText
LoginHint Text
RedirectURL Text
Scopes List of [Text]
TokenCache Text
AccessToken SecretText
NewTokenCache Text

Returns

Type Description
Boolean

AcquireOnBehalfOfTokensByTokenCache

[TryFunction]
procedure AcquireOnBehalfOfTokensByTokenCache(ClientId: Text, ClientSecret: SecretText, LoginHint: Text, RedirectURL: Text, Scopes: List of [Text], TokenCache: Text, var AccessToken: SecretText, var IdToken: Text, var NewTokenCache: Text): Boolean

Parameters

Name Type Description
ClientId Text
ClientSecret SecretText
LoginHint Text
RedirectURL Text
Scopes List of [Text]
TokenCache Text
AccessToken SecretText
IdToken Text
NewTokenCache Text

Returns

Type Description
Boolean

GetLastErrorMessage

Get the last error message that happened during acquiring of an access token.

procedure GetLastErrorMessage(): Text

Returns

Type Description
Text

The last error message that happened during acquiring of an access token.

GetDefaultRedirectURL

Returns the default Business Central redirectURL

[NonDebuggable]
procedure GetDefaultRedirectURL(var RedirectUrl: Text)

Parameters

Name Type Description
RedirectUrl Text

See also