Codeunit 501 "OAuth2"
System Application · System.Security.Authentication
Across versions
- BC23present
- BC2452 procedures added, 26 procedures changed
- BC25unchanged
- BC261 procedures added
- BC2726 procedures removed, 1 procedures added
- BC2817 procedures removed
- BC29-30unchanged
Neighbourhood 26 connected objects and pages
System Application · System.Security.Authentication · BC23-30 · source at ea08af5e · facts from BC29
Properties
| Property | Value |
|---|---|
| Access | Public |
Procedures
AcquireTokenByAuthorizationCodeWithCertificate(ClientId: Text; Certificate: SecretText; OAuthAuthorityUrl: Text; RedirectURL: Text; ResourceURL: Text; PromptInteraction: Enum "Prompt Interaction"; var AccessToken: SecretText; var AuthCodeErr: Text)Δ BC24 Δ BC24 + BC24 + BC24 + BC24 + BC24 + BC24 + BC24 + BC24 + BC24 − BC27 − BC27 − BC27 − BC28 − BC28 − BC28: Gets the authorization token based on the authorization code via the OAuth2 v1.0 code grant flow.AcquireTokenByAuthorizationCodeWithCertificate(ClientId: Text; Certificate: SecretText; CertificatePassword: SecretText; OAuthAuthorityUrl: Text; RedirectURL: Text; ResourceURL: Text; PromptInteraction: Enum "Prompt Interaction"; var AccessToken: SecretText; var AuthCodeErr: Text)Δ BC24 Δ BC24 + BC24 + BC24 + BC24 + BC24 + BC24 + BC24 + BC24 + BC24 − BC27 − BC27 − BC27 − BC28 − BC28 − BC28: Gets the authorization token based on the authorization code via the OAuth2 v1.0 code grant flow.AcquireTokenByAuthorizationCode(ClientId: Text; ClientSecret: SecretText; OAuthAuthorityUrl: Text; RedirectURL: Text; Scopes: List of [Text]; PromptInteraction: Enum "Prompt Interaction"; var AccessToken: SecretText; var AuthCodeErr: Text)Δ BC24 + BC24 − BC27: Gets the authorization token based on the authorization code via the OAuth2 v2.0 code grant flow.AcquireTokenByAuthorizationCodeWithCertificate(ClientId: Text; Certificate: SecretText; OAuthAuthorityUrl: Text; RedirectURL: Text; Scopes: List of [Text]; PromptInteraction: Enum "Prompt Interaction"; var AccessToken: SecretText; var AuthCodeErr: Text)Δ BC24 Δ BC24 + BC24 + BC24 + BC24 + BC24 + BC24 + BC24 + BC24 + BC24 − BC27 − BC27 − BC27 − BC28 − BC28 − BC28: Gets the authorization token based on the authorization code via the OAuth2 v2.0 code grant flow.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)Δ BC24 Δ BC24 + BC24 + BC24 + BC24 + BC24 + BC24 + BC24 + BC24 + BC24 − BC27 − BC27 − BC27 − BC28 − BC28 − BC28: Gets the authorization token based on the authorization code via the OAuth2 v2.0 code grant flow.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)Δ BC24 + BC24 − BC27: Gets the authorization token based on the authorization code via the OAuth2 v2.0 code grant flow.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)Δ BC24 + BC24 + BC24 + BC24 + BC24 − BC27 − BC28 − BC28: Gets the authorization token based on the authorization code via the OAuth2 v2.0 code grant flow.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)Δ BC24 + BC24 + BC24 + BC24 + BC24 − BC27 − BC28 − BC28: Gets the authorization token based on the authorization code via the OAuth2 v2.0 code grant flow.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)Δ BC24 + BC24 − BC27: Gets the access token and token cache state with authorization code flow.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)Δ BC24 + BC24 + BC24 + BC24 + BC24 − BC27 − BC28 − BC28: Gets the access token and token cache state with authorization code flow.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)Δ BC24 + BC24 + BC24 + BC24 + BC24 − BC27 − BC28 − BC28: Gets the access token and token cache state with authorization code flow.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)Δ BC24 + BC24 − BC27: Gets the access token and token cache state with authorization code flow.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)Δ BC24 + BC24 + BC24 + BC24 + BC24 − BC27 − BC28 − BC28: Gets the access token and token cache state with authorization code flow.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)Δ BC24 + BC24 + BC24 + BC24 + BC24 − BC27 − BC28 − BC28: Gets the access token and token cache state with authorization code flow.AcquireOnBehalfOfToken(RedirectURL: Text; Scopes: List of [Text]; var AccessToken: SecretText)Δ BC24 + BC24 − BC27: Gets the authentication token via the On-Behalf-Of OAuth2 v2.0 protocol flow.AcquireOnBehalfOfTokens(RedirectURL: Text; Scopes: List of [Text]; var AccessToken: SecretText; var IdToken: Text)Δ BC24 + BC24 − BC27: Gets the authentication token via the On-Behalf-Of OAuth2 v2.0 protocol flow.RequestClientCredentialsAdminPermissions(ClientId: Text; OAuthAuthorityUrl: Text; RedirectURL: Text; var HasGrantConsentSucceeded: Boolean; var PermissionGrantError: Text)Δ BC24: Request the permissions from a directory admin.AcquireTokenWithClientCredentials(ClientId: Text; ClientSecret: SecretText; OAuthAuthorityUrl: Text; RedirectURL: Text; ResourceURL: Text; var AccessToken: SecretText)Δ BC24 Δ BC24 + BC24 + BC24 − BC27 − BC27: Gets the access token via the Client Credentials OAuth2 v1.0 grant flow.AcquireTokenWithClientCredentials(ClientId: Text; ClientSecret: SecretText; OAuthAuthorityUrl: Text; RedirectURL: Text; Scopes: List of [Text]; var AccessToken: SecretText)Δ BC24 Δ BC24 + BC24 + BC24 − BC27 − BC27: Gets the access token via the Client Credentials OAuth2 v2.0 grant flow.AcquireAuthorizationCodeTokenFromCacheWithCertificate(ClientId: Text; Certificate: SecretText; RedirectURL: Text; OAuthAuthorityUrl: Text; ResourceURL: Text; var AccessToken: SecretText)Δ BC24 Δ BC24 + BC24 + BC24 + BC24 + BC24 + BC24 + BC24 + BC24 + BC24 − BC27 − BC27 − BC28 − BC28 − BC28 − BC28: Gets the access token from cache or a refreshed token via OAuth2 v1.0 protocol.AcquireAuthorizationCodeTokenFromCacheWithCertificate(ClientId: Text; Certificate: SecretText; CertificatePassword: SecretText; RedirectURL: Text; OAuthAuthorityUrl: Text; ResourceURL: Text; var AccessToken: SecretText)Δ BC24 Δ BC24 + BC24 + BC24 + BC24 + BC24 + BC24 + BC24 + BC24 + BC24 − BC27 − BC27 − BC28 − BC28 − BC28 − BC28: Gets the access token from cache or a refreshed token via OAuth2 v1.0 protocol.AcquireAuthorizationCodeTokenFromCache(ClientId: Text; ClientSecret: SecretText; RedirectURL: Text; OAuthAuthorityUrl: Text; Scopes: List of [Text]; var AccessToken: SecretText)Δ BC24 + BC24 − BC27: Gets the access token from cache or a refreshed token via OAuth2 v2.0 protocol.AcquireTokensFromCache(ClientId: Text; ClientSecret: SecretText; RedirectURL: Text; OAuthAuthorityUrl: Text; Scopes: List of [Text]; var AccessToken: SecretText; var IdToken: Text)Δ BC24 + BC24 − BC27: Gets the access token from cache or a refreshed token via OAuth2 v2.0 protocol.AcquireAuthorizationCodeTokenFromCacheWithCertificate(ClientId: Text; Certificate: SecretText; RedirectURL: Text; OAuthAuthorityUrl: Text; Scopes: List of [Text]; var AccessToken: SecretText)Δ BC24 Δ BC24 + BC24 + BC24 + BC24 + BC24 + BC24 + BC24 + BC24 + BC24 − BC27 − BC27 − BC28 − BC28 − BC28 − BC28: Gets the access token from cache or a refreshed token via OAuth2 v2.0 protocol.AcquireAuthorizationCodeTokenFromCacheWithCertificate(ClientId: Text; Certificate: SecretText; CertificatePassword: SecretText; RedirectURL: Text; OAuthAuthorityUrl: Text; Scopes: List of [Text]; var AccessToken: SecretText)Δ BC24 Δ BC24 + BC24 + BC24 + BC24 + BC24 + BC24 + BC24 + BC24 + BC24 − BC27 − BC27 − BC28 − BC28 − BC28 − BC28: Gets the access token from cache or a refreshed token via OAuth2 v2.0 protocol.AcquireTokensFromCacheWithCertificate(ClientId: Text; Certificate: SecretText; RedirectURL: Text; OAuthAuthorityUrl: Text; Scopes: List of [Text]; var AccessToken: SecretText; var IdToken: Text)Δ BC24 + BC24 + BC24 + BC24 + BC24 − BC27 − BC28 − BC28: Gets the access token from cache or a refreshed token via OAuth2 v2.0 protocol.AcquireTokensFromCacheWithCertificate(ClientId: Text; Certificate: SecretText; CertificatePassword: SecretText; RedirectURL: Text; OAuthAuthorityUrl: Text; Scopes: List of [Text]; var AccessToken: SecretText; var IdToken: Text)Δ BC24 + BC24 + BC24 + BC24 + BC24 − BC27 − BC28 − BC28: Gets the access token from cache or a refreshed token via OAuth2 v2.0 protocol.AcquireTokensWithCertificate(ClientId: Text; Certificate: SecretText; RedirectURL: Text; OAuthAuthorityUrl: Text; Scopes: List of [Text]; var AccessToken: SecretText; var IdToken: Text)Δ BC24 + BC24 + BC24 + BC24 + BC24 − BC27 − BC28 − BC28: Gets the access token via OAuth2 v2.0 protocol, authenticating as a service principal (as the app whose credentials you are providing).AcquireTokensWithCertificate(ClientId: Text; Certificate: SecretText; CertificatePassword: SecretText; RedirectURL: Text; OAuthAuthorityUrl: Text; Scopes: List of [Text]; var AccessToken: SecretText; var IdToken: Text)Δ BC24 + BC24 + BC24 + BC24 + BC24 − BC27 − BC28 − BC28: Gets the access token via OAuth2 v2.0 protocol, authenticating as a service principal (as the app whose credentials you are providing).AcquireOnBehalfAccessTokenAndTokenCache(OAuthAuthorityUrl: Text; RedirectURL: Text; Scopes: List of [Text]; var AccessToken: SecretText; var TokenCache: Text)Δ BC24 + BC24 − BC27: Gets the access and refresh token via the On-Behalf-Of OAuth2 v2.0 protocol flow.AcquireOnBehalfTokensAndTokenCache(OAuthAuthorityUrl: Text; RedirectURL: Text; Scopes: List of [Text]; var AccessToken: SecretText; var IdToken: Text; var TokenCache: Text)Δ BC24 + BC24 − BC27: Gets the access and refresh token via the On-Behalf-Of OAuth2 v2.0 protocol flow.AcquireOnBehalfOfTokenByTokenCache(LoginHint: Text; RedirectURL: Text; Scopes: List of [Text]; TokenCache: Text; var AccessToken: SecretText; var NewTokenCache: Text)Δ BC24 Δ BC24 + BC24 + BC24 − BC27 − BC27: Gets the token and token cache via the On-Behalf-Of OAuth2 v1.0 protocol flow.AcquireOnBehalfOfTokensByTokenCache(LoginHint: Text; RedirectURL: Text; Scopes: List of [Text]; TokenCache: Text; var AccessToken: SecretText; var IdToken: Text; var NewTokenCache: Text)Δ BC24 Δ BC24 + BC24 + BC24 − BC27 − BC27: Gets the token and token cache via the On-Behalf-Of OAuth2 v1.0 protocol flow.AcquireOnBehalfOfTokenByTokenCache(ClientId: Text; ClientSecret: SecretText; LoginHint: Text; RedirectURL: Text; Scopes: List of [Text]; TokenCache: Text; var AccessToken: SecretText; var NewTokenCache: Text)Δ BC24 Δ BC24 + BC24 + BC24 − BC27 − BC27: Gets the token and token cache via the On-Behalf-Of OAuth2 v1.0 protocol flow.AcquireOnBehalfOfTokensByTokenCache(ClientId: Text; ClientSecret: SecretText; LoginHint: Text; RedirectURL: Text; Scopes: List of [Text]; TokenCache: Text; var AccessToken: SecretText; var IdToken: Text; var NewTokenCache: Text)Δ BC24 Δ BC24 + BC24 + BC24 − BC27 − BC27: Gets the token and token cache via the On-Behalf-Of OAuth2 v1.0 protocol flow.AcquireAuthorizationCode(ClientId: Text; ClientSecret: SecretText; OAuthAuthorityUrl: Text; RedirectURL: Text; Scopes: List of [Text]; PromptInteraction: Enum "Prompt Interaction"; Audience: Text; var AuthCode: Text; var AuthCodeErr: Text)+ BC27: Gets the authorization token based on the authorization code via the OAuth2 v2.0 code grant flow.GetClaims(JWT: SecretText): JsonObject+ BC26: Gets the Claims Set from a JSON Web Token (JWT).GetLastErrorMessage(): Text: Get the last error message that happened during acquiring of an access token.GetDefaultRedirectURL(var RedirectUrl: Text): Returns the default Business Central redirectURL
Calls
From the extracted call graph of BC29 (graphify-al on the snapshot checkout): calls whose target is known from a declared type or an Object::"Name" argument. Interface dispatch and calls through events are not counted, so the list is not complete.
- Codeunit 502 “OAuth2Impl” (25 calls:
AcquireAuthorizationCode → AcquireAuthorizationCode,AcquireAuthorizationCodeTokenFromCache → AcquireTokenFromCache,AcquireAuthorizationCodeTokenFromCacheWithCertificate → AcquireTokenFromCacheWithCertificate, …)
Called by
- Codeunit 7201 “CDS Integration Impl.” (8 calls:
GetAccessToken → AcquireAuthorizationCodeTokenFromCache,GetAccessToken → AcquireAuthorizationCodeTokenFromCacheWithCertificate,GetAccessToken → AcquireTokenByAuthorizationCode, …) - Codeunit 4507 “Email - OAuth Client” (7 calls:
AuthorizationCodeTokenCacheExists → AcquireAuthorizationCodeTokenFromCache,GetLastAuthorizationErrorMessage → GetLastErrorMessage,Initialize → GetDefaultRedirectURL, …) - Codeunit 7203 “CDS Environment” (6 calls:
GetGlobalDiscoverabilityOnBehalfTokenAsSecretText → AcquireOnBehalfOfToken,GetGlobalDiscoverabilityToken → AcquireAuthorizationCodeTokenFromCache,GetGlobalDiscoverabilityToken → AcquireAuthorizationCodeTokenFromCacheWithCertificate, …) - Codeunit 102 “Import Consolidation from API” (4 calls:
GetToken → AcquireAuthorizationCodeTokenFromCache,GetToken → AcquireAuthorizationCodeTokenFromCacheWithCertificate,GetToken → AcquireTokensByAuthorizationCode, …) - Codeunit 4700 “VAT Group Communication” (4 calls:
GetBearerToken → AcquireTokenByAuthorizationCode,GetBearerToken → AcquireTokenByAuthorizationCodeWithCertificate,GetBearerTokenFromCache → AcquireAuthorizationCodeTokenFromCache, …) - Codeunit 1686 “Email Logging OAuth Client” (3 calls:
AuthorizationCodeTokenCacheExists → AcquireAuthorizationCodeTokenFromCache,GetLastErrorMessage → GetLastErrorMessage,TryGetAccessTokenInternal → AcquireOnBehalfOfToken) - Codeunit 9510 “Document Service Management” (3 calls:
GetAccessToken → AcquireAuthorizationCodeTokenFromCache,GetAccessToken → AcquireTokenByAuthorizationCode,InitializeDefaultService → GetDefaultRedirectURL) - Codeunit 560 “CrossIntercompany Connector” (2 calls:
AcquireBearerAccessToken → AcquireTokenWithClientCredentials,AcquireBearerAccessToken → GetDefaultRedirectURL) - Codeunit 7247 “MDM Http Source Transport” (2 calls:
AcquireToken → AcquireTokenWithClientCredentials,TryAcquireTokenFromCache → AcquireAuthorizationCodeTokenFromCache) - Codeunit 9144 “SharePoint Authorization Code” (2 calls:
AcquireToken → AcquireAuthorizationCodeTokenFromCache,AcquireToken → AcquireTokenByAuthorizationCode) - Page 7201 “CDS Connection Setup Wizard” (2 calls:
GetCDSEnvironment → AcquireOnBehalfOfToken,OnOpenPage → GetDefaultRedirectURL) - Codeunit 1410 “Doc. Exch. Service Mgt.” (1 call:
GetDefaultRedirectUrl → GetDefaultRedirectURL) - Codeunit 1681 “Email Logging Management” (1 call:
PromptClientCredentials → GetDefaultRedirectURL) - Codeunit 2020 “Image Analysis Management” (1 call:
TryAcquireOAuth2Token → AcquireTokensWithCertificate) - Codeunit 4516 “OAuth2 SMTP Authentication” (1 call:
AuthenticateWithOAuth2CustomAppReg → RequestClientCredentialsAdminPermissions) - Codeunit 6904 “Expense OAuth Client” (1 call:
GetAccessToken → AcquireOnBehalfOfToken) - Codeunit 6941 “EA Http Client” (1 call:
TryGetAccessToken → AcquireOnBehalfOfToken) - Codeunit 7802 “Azure Functions OAuth2” (1 call:
Authenticate → AcquireTokenWithClientCredentials) - Codeunit 7807 “Azure Functions OAuth2 Cert” (1 call:
Authenticate → AcquireTokensWithCertificate) - Page 4509 “Email - Outlook API Setup” (1 call:
OnOpenPage → GetDefaultRedirectURL) - Page 4705 “VAT Group Setup Guide” (1 call:
ShowSetupMemberOAuth2Step → GetDefaultRedirectURL) - Page 7200 “CDS Connection Setup” (1 call:
InitializeDefaultRedirectUrl → GetDefaultRedirectURL) - Page 9861 “AAD Application Card” (1 call:
GrantConsent → RequestClientCredentialsAdminPermissions) - Page extension 4703 “VAT Report Setup Extension” (1 call:
OnOpenPage → GetDefaultRedirectURL) - Table 1680 “Email Logging Setup” (1 call:
GetDefaultRedirectUrl → GetDefaultRedirectURL)
Ask your agent
Procedure bodies are not stored here (D10). The call sections above are our own, per object, from the BC29 call graph. For a procedure body or the calls of one procedure, ask bc-code-atlas (external, by Stefan Maron, MIT; default corpus w1-28), which the bc-observatory plugin connects: bcatlas_resolve_node(object_type: "codeunit", object_name: "OAuth2"), then bcatlas_get_procedure_body or bcatlas_get_neighbors on the returned id.