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.

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

[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

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

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

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 v2.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, Scopes: List of [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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

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

AcquireTokensByAuthorizationCode

Obsolete

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

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

[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

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

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.

IdToken Text

Exit parameter containing the id token.

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

AcquireTokensByAuthorizationCodeWithCertificate

Obsolete

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

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

[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

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

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.

IdToken Text

Exit parameter containing the id token.

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

AcquireTokenAndTokenCacheByAuthorizationCode

Obsolete

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

Gets the access token and token cache state with authorization code flow.

[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

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

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 Error for a description of the error.

TokenCache Text

Exit parameter containing the token cache acquired when the access token was requested.

Error 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

AcquireTokenAndTokenCacheByAuthorizationCodeWithCertificate

Obsolete

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

Gets the access token and token cache state with authorization code flow.

[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

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

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 Error for a description of the error.

TokenCache Text

Exit parameter containing the token cache acquired when the access token was requested.

Error 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

AcquireTokensAndTokenCacheByAuthorizationCode

Obsolete

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

Gets the access token and token cache state with authorization code flow.

[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

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

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 Error for a description of the error.

IdToken Text

Exit parameter containing the id token.

TokenCache Text

Exit parameter containing the token cache acquired when the access token was requested.

Error 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

AcquireTokensAndTokenCacheByAuthorizationCodeWithCertificate

Obsolete

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

Gets the access token and token cache state with authorization code flow.

[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

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

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 Error for a description of the error.

IdToken Text

Exit parameter containing the id token.

TokenCache Text

Exit parameter containing the token cache acquired when the access token was requested.

Error 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

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.

Gets the access token via the Client Credentials OAuth2 v2.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, Scopes: List of [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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

AccessToken Text

Exit parameter containing the access token.

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.

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

[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

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.

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 Application (client) ID that the Azure portal – App registrations experience assigned to your app.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

AccessToken Text

Exit parameter containing the access token.

Returns

Type Description
Boolean

AcquireTokensFromCache

Obsolete

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

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

[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

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.

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 Application (client) ID that the Azure portal – App registrations experience assigned to your app.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

AccessToken Text

Exit parameter containing the access token.

IdToken Text

Exit parameter containing the id token.

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 v2.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, Scopes: List of [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 Application (client) ID that the Azure portal – App registrations experience assigned to your app.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

AccessToken Text

Exit parameter containing the access token.

Returns

Type Description
Boolean

AcquireTokensFromCacheWithCertificate

Obsolete

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

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

[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

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 Application (client) ID that the Azure portal – App registrations experience assigned to your app.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

AccessToken Text

Exit parameter containing the access token.

IdToken Text

Exit parameter containing the id token.

Returns

Type Description
Boolean

AcquireTokensWithCertificate

Obsolete

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

Gets the access token via OAuth2 v2.0 protocol, authenticating as a service principal (as the app whose credentials you are providing).

[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

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 Application (client) ID that the Azure portal – App registrations experience assigned to your app.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

AccessToken Text

Exit parameter containing the access token.

IdToken Text

Exit parameter containing the id token.

Returns

Type Description
Boolean

AcquireOnBehalfOfTokenByTokenCache

Obsolete

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

Gets the token and token cache via the On-Behalf-Of OAuth2 v1.0 protocol flow.

[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

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.

LoginHint Text

The user login hint, i.e. authentication email.

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

TokenCache Text

The token cache acquired when the access token was requested .

AccessToken Text

Exit parameter containing the access token.

NewTokenCache Text

Exit parameter containing the new token cache.

Returns

Type Description
Boolean

AcquireOnBehalfOfTokensByTokenCache

Obsolete

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

Gets the token and token cache via the On-Behalf-Of OAuth2 v1.0 protocol flow.

[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

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.

LoginHint Text

The user login hint, i.e. authentication email.

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

TokenCache Text

The token cache acquired when the access token was requested .

AccessToken Text

Exit parameter containing the access token.

IdToken Text

Exit parameter containing the id token.

NewTokenCache Text

Exit parameter containing the new token cache.

Returns

Type Description
Boolean

AcquireTokenByAuthorizationCodeWithCertificate

Obsolete

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

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

[TryFunction]
[Obsolete(Use AcquireTokenByAuthorizationCodeWithCertificate with SecretText data type for AccessToken and Certificate.,25.0)]
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: 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 SecretText

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

Obsolete

This element will become obsolete from version 25.0. Use AcquireTokenByAuthorizationCodeWithCertificate with SecretText data type for AccessToken, Certificate and CertificatePassword.

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

[TryFunction]
[Obsolete(Use AcquireTokenByAuthorizationCodeWithCertificate with SecretText data type for AccessToken, Certificate and CertificatePassword.,25.0)]
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

AcquireTokenByAuthorizationCodeWithCertificate

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

[TryFunction]
procedure AcquireTokenByAuthorizationCodeWithCertificate(ClientId: Text, Certificate: SecretText, 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 SecretText

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

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

[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

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

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

Obsolete

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

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

[TryFunction]
[Obsolete(Use AcquireTokenByAuthorizationCodeWithCertificate with SecretText data type for AccessToken and Certificate.,25.0)]
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

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

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 v2.0 code grant flow.

[TryFunction]
procedure AcquireTokenByAuthorizationCodeWithCertificate(ClientId: Text, Certificate: 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

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

Certificate SecretText

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

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

Obsolete

This element will become obsolete from version 25.0. Use AcquireTokenByAuthorizationCodeWithCertificate with SecretText data type for AccessToken, Certificate and CertificatePassword.

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

[TryFunction]
[Obsolete(Use AcquireTokenByAuthorizationCodeWithCertificate with SecretText data type for AccessToken, Certificate and CertificatePassword.,25.0)]
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

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

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 v2.0 code grant flow.

[TryFunction]
procedure AcquireTokenByAuthorizationCodeWithCertificate(ClientId: Text, Certificate: SecretText, 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

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

Certificate SecretText

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

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

AcquireTokensByAuthorizationCode

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

[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

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

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.

IdToken Text

Exit parameter containing the id token.

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

AcquireTokensByAuthorizationCodeWithCertificate

Obsolete

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

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

[TryFunction]
[Obsolete(Use AcquireTokensByAuthorizationCodeWithCertificate with SecretText data type for AccessToken and Certificate.,25.0)]
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

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

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.

IdToken Text

Exit parameter containing the id token.

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

AcquireTokensByAuthorizationCodeWithCertificate

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

[TryFunction]
procedure AcquireTokensByAuthorizationCodeWithCertificate(ClientId: Text, Certificate: 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

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

Certificate SecretText

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

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.

IdToken Text

Exit parameter containing the id token.

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

AcquireTokensByAuthorizationCodeWithCertificate

Obsolete

This element will become obsolete from version 25.0. Use AcquireTokensByAuthorizationCodeWithCertificate with SecretText data type for AccessToken, Certificate and CertificatePassword.

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

[TryFunction]
[Obsolete(Use AcquireTokensByAuthorizationCodeWithCertificate with SecretText data type for AccessToken, Certificate and CertificatePassword.,25.0)]
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

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

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.

IdToken Text

Exit parameter containing the id token.

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

AcquireTokensByAuthorizationCodeWithCertificate

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

[TryFunction]
procedure AcquireTokensByAuthorizationCodeWithCertificate(ClientId: Text, Certificate: SecretText, 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

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

Certificate SecretText

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

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.

IdToken Text

Exit parameter containing the id token.

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

AcquireTokenAndTokenCacheByAuthorizationCode

Gets the access token and token cache state with authorization code flow.

[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

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

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 Error for a description of the error.

TokenCache Text

Exit parameter containing the token cache acquired when the access token was requested.

Error 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

AcquireTokenAndTokenCacheByAuthorizationCodeWithCertificate

Obsolete

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

Gets the access token and token cache state with authorization code flow.

[TryFunction]
[Obsolete(Use AcquireTokenAndTokenCacheByAuthorizationCodeWithCertificate with SecretText data type for AccessToken and Certificate.,25.0)]
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

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

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 Error for a description of the error.

TokenCache Text

Exit parameter containing the token cache acquired when the access token was requested.

Error 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

AcquireTokenAndTokenCacheByAuthorizationCodeWithCertificate

Gets the access token and token cache state with authorization code flow.

[TryFunction]
procedure AcquireTokenAndTokenCacheByAuthorizationCodeWithCertificate(ClientId: Text, Certificate: 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

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

Certificate SecretText

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

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 Error for a description of the error.

TokenCache Text

Exit parameter containing the token cache acquired when the access token was requested.

Error 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

AcquireTokenAndTokenCacheByAuthorizationCodeWithCertificate

Obsolete

This element will become obsolete from version 25.0. Use AcquireTokenAndTokenCacheByAuthorizationCodeWithCertificate with SecretText data type for AccessToken, Certificate and CertificatePassword.

Gets the access token and token cache state with authorization code flow.

[TryFunction]
[Obsolete(Use AcquireTokenAndTokenCacheByAuthorizationCodeWithCertificate with SecretText data type for AccessToken, Certificate and CertificatePassword.,25.0)]
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

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

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 Error for a description of the error.

TokenCache Text

Exit parameter containing the token cache acquired when the access token was requested.

Error 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

AcquireTokenAndTokenCacheByAuthorizationCodeWithCertificate

Gets the access token and token cache state with authorization code flow.

[TryFunction]
procedure AcquireTokenAndTokenCacheByAuthorizationCodeWithCertificate(ClientId: Text, Certificate: SecretText, 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

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

Certificate SecretText

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

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 Error for a description of the error.

TokenCache Text

Exit parameter containing the token cache acquired when the access token was requested.

Error 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

AcquireTokensAndTokenCacheByAuthorizationCode

Gets the access token and token cache state with authorization code flow.

[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

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

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 Error for a description of the error.

IdToken Text

Exit parameter containing the id token.

TokenCache Text

Exit parameter containing the token cache acquired when the access token was requested.

Error 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

AcquireTokensAndTokenCacheByAuthorizationCodeWithCertificate

Obsolete

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

Gets the access token and token cache state with authorization code flow.

[TryFunction]
[Obsolete(Use AcquireTokensAndTokenCacheByAuthorizationCodeWithCertificate with SecretText data type for AccessToken and Certificate.,25.0)]
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

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

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 Error for a description of the error.

IdToken Text

Exit parameter containing the id token.

TokenCache Text

Exit parameter containing the token cache acquired when the access token was requested.

Error 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

AcquireTokensAndTokenCacheByAuthorizationCodeWithCertificate

Gets the access token and token cache state with authorization code flow.

[TryFunction]
procedure AcquireTokensAndTokenCacheByAuthorizationCodeWithCertificate(ClientId: Text, Certificate: 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

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

Certificate SecretText

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

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 Error for a description of the error.

IdToken Text

Exit parameter containing the id token.

TokenCache Text

Exit parameter containing the token cache acquired when the access token was requested.

Error 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

AcquireTokensAndTokenCacheByAuthorizationCodeWithCertificate

Obsolete

This element will become obsolete from version 25.0. Use AcquireTokensAndTokenCacheByAuthorizationCodeWithCertificate with SecretText data type for AccessToken, Certificate and CertificatePassword.

Gets the access token and token cache state with authorization code flow.

[TryFunction]
[Obsolete(Use AcquireTokensAndTokenCacheByAuthorizationCodeWithCertificate with SecretText data type for AccessToken, Certificate and CertificatePassword.,25.0)]
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

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

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 Error for a description of the error.

IdToken Text

Exit parameter containing the id token.

TokenCache Text

Exit parameter containing the token cache acquired when the access token was requested.

Error 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

AcquireTokensAndTokenCacheByAuthorizationCodeWithCertificate

Gets the access token and token cache state with authorization code flow.

[TryFunction]
procedure AcquireTokensAndTokenCacheByAuthorizationCodeWithCertificate(ClientId: Text, Certificate: SecretText, 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

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

Certificate SecretText

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

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 Error for a description of the error.

IdToken Text

Exit parameter containing the id token.

TokenCache Text

Exit parameter containing the token cache acquired when the access token was requested.

Error 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

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

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

[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

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

AccessToken SecretText

Exit parameter containing the access token.

Returns

Type Description
Boolean

AcquireAuthorizationCodeTokenFromCacheWithCertificate

Obsolete

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

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

[TryFunction]
[Obsolete(Use AcquireAuthorizationCodeTokenFromCacheWithCertificate with SecretText data type for AccessToken and Certificate.,25.0)]
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: 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 SecretText

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

Obsolete

This element will become obsolete from version 25.0. Use AcquireAuthorizationCodeTokenFromCacheWithCertificate with SecretText data type for AccessToken, Certificate and CertificatePassword.

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

[TryFunction]
[Obsolete(Use AcquireAuthorizationCodeTokenFromCacheWithCertificate with SecretText data type for AccessToken, Certificate and CertificatePassword.,25.0)]
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

AcquireAuthorizationCodeTokenFromCacheWithCertificate

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

[TryFunction]
procedure AcquireAuthorizationCodeTokenFromCacheWithCertificate(ClientId: Text, Certificate: SecretText, 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 SecretText

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

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

[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

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.

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 Application (client) ID that the Azure portal – App registrations experience assigned to your app.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

AccessToken SecretText

Exit parameter containing the access token.

Returns

Type Description
Boolean

AcquireTokensFromCache

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

[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

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.

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 Application (client) ID that the Azure portal – App registrations experience assigned to your app.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

AccessToken SecretText

Exit parameter containing the access token.

IdToken Text

Exit parameter containing the id token.

Returns

Type Description
Boolean

AcquireAuthorizationCodeTokenFromCacheWithCertificate

Obsolete

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

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

[TryFunction]
[Obsolete(Use AcquireAuthorizationCodeTokenFromCacheWithCertificate with SecretText data type for AccessToken and Certificate.,25.0)]
procedure AcquireAuthorizationCodeTokenFromCacheWithCertificate(ClientId: Text, Certificate: Text, RedirectURL: Text, OAuthAuthorityUrl: Text, Scopes: List of [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 Application (client) ID that the Azure portal – App registrations experience assigned to your app.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

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 v2.0 protocol.

[TryFunction]
procedure AcquireAuthorizationCodeTokenFromCacheWithCertificate(ClientId: Text, Certificate: SecretText, RedirectURL: Text, OAuthAuthorityUrl: Text, Scopes: List of [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 SecretText

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 Application (client) ID that the Azure portal – App registrations experience assigned to your app.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

AccessToken SecretText

Exit parameter containing the access token.

Returns

Type Description
Boolean

AcquireAuthorizationCodeTokenFromCacheWithCertificate

Obsolete

This element will become obsolete from version 25.0. Use AcquireAuthorizationCodeTokenFromCacheWithCertificate with SecretText data type for AccessToken, Certificate and CertificatePassword.

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

[TryFunction]
[Obsolete(Use AcquireAuthorizationCodeTokenFromCacheWithCertificate with SecretText data type for AccessToken, Certificate and CertificatePassword.,25.0)]
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

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 Application (client) ID that the Azure portal – App registrations experience assigned to your app.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

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 v2.0 protocol.

[TryFunction]
procedure AcquireAuthorizationCodeTokenFromCacheWithCertificate(ClientId: Text, Certificate: SecretText, CertificatePassword: SecretText, RedirectURL: Text, OAuthAuthorityUrl: Text, Scopes: List of [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 SecretText

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 Application (client) ID that the Azure portal – App registrations experience assigned to your app.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

AccessToken SecretText

Exit parameter containing the access token.

Returns

Type Description
Boolean

AcquireTokensFromCacheWithCertificate

Obsolete

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

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

[TryFunction]
[Obsolete(Use AcquireTokensFromCacheWithCertificate with SecretText data type for AccessToken and Certificate.,25.0)]
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

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

AccessToken SecretText

Exit parameter containing the access token.

IdToken Text

Exit parameter containing the id token.

Returns

Type Description
Boolean

AcquireTokensFromCacheWithCertificate

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

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

Parameters

Name Type Description
ClientId Text

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

Certificate SecretText

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

AccessToken SecretText

Exit parameter containing the access token.

IdToken Text

Exit parameter containing the id token.

Returns

Type Description
Boolean

AcquireTokensFromCacheWithCertificate

Obsolete

This element will become obsolete from version 25.0. Use AcquireTokensWithCertificate with SecretText data type for AccessToken, Certificate and CertificatePassword.

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

[TryFunction]
[Obsolete(Use AcquireTokensWithCertificate with SecretText data type for AccessToken, Certificate and CertificatePassword.,25.0)]
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

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

AccessToken SecretText

Exit parameter containing the access token.

IdToken Text

Exit parameter containing the id token.

Returns

Type Description
Boolean

AcquireTokensFromCacheWithCertificate

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

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

Parameters

Name Type Description
ClientId Text

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

Certificate SecretText

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

AccessToken SecretText

Exit parameter containing the access token.

IdToken Text

Exit parameter containing the id token.

Returns

Type Description
Boolean

AcquireTokensWithCertificate

Obsolete

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

Gets the access token via OAuth2 v2.0 protocol, authenticating as a service principal (as the app whose credentials you are providing).

[TryFunction]
[Obsolete(Use AcquireTokensWithCertificate with SecretText data type for AccessToken and Certificate.,25.0)]
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

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

AccessToken SecretText

Exit parameter containing the access token.

IdToken Text

Exit parameter containing the id token.

Returns

Type Description
Boolean

AcquireTokensWithCertificate

Gets the access token via OAuth2 v2.0 protocol, authenticating as a service principal (as the app whose credentials you are providing).

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

Parameters

Name Type Description
ClientId Text

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

Certificate SecretText

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

AccessToken SecretText

Exit parameter containing the access token.

IdToken Text

Exit parameter containing the id token.

Returns

Type Description
Boolean

AcquireTokensWithCertificate

Obsolete

This element will become obsolete from version 25.0. Use AcquireTokensWithCertificate with SecretText data type for AccessToken, Certificate and CertificatePassword.

Gets the access token via OAuth2 v2.0 protocol, authenticating as a service principal (as the app whose credentials you are providing).

[TryFunction]
[Obsolete(Use AcquireTokensWithCertificate with SecretText data type for AccessToken, Certificate and CertificatePassword.,25.0)]
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

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

AccessToken SecretText

Exit parameter containing the access token.

IdToken Text

Exit parameter containing the id token.

Returns

Type Description
Boolean

AcquireTokensWithCertificate

Gets the access token via OAuth2 v2.0 protocol, authenticating as a service principal (as the app whose credentials you are providing).

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

Parameters

Name Type Description
ClientId Text

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

Certificate SecretText

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

AccessToken SecretText

Exit parameter containing the access token.

IdToken Text

Exit parameter containing the id token.

Returns

Type Description
Boolean

AcquireOnBehalfOfTokenByTokenCache

Gets the token and token cache via the On-Behalf-Of OAuth2 v1.0 protocol flow.

[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

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.

LoginHint Text

The user login hint, i.e. authentication email.

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

TokenCache Text

The token cache acquired when the access token was requested .

AccessToken SecretText

Exit parameter containing the access token.

NewTokenCache Text

Exit parameter containing the new token cache.

Returns

Type Description
Boolean

AcquireOnBehalfOfTokensByTokenCache

Gets the token and token cache via the On-Behalf-Of OAuth2 v1.0 protocol flow.

[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

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.

LoginHint Text

The user login hint, i.e. authentication email.

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.

Scopes List of [Text]

A list of scopes that you want the user to consent to.

TokenCache Text

The token cache acquired when the access token was requested .

AccessToken SecretText

Exit parameter containing the access token.

IdToken Text

Exit parameter containing the id token.

NewTokenCache Text

Exit parameter containing the new token cache.

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