Codeunit 5505379 M365 Authorization Management
Management Codeunit to handle OAuth2 authorization based on configuration.
procedure ValidateUrl(url: Text)
Validate an url for correct format.
url Text
Complete url.
procedure GetAndClearLastError(): Text
Returns and clears the last stored error.
Returns Text
Last error text.
procedure AcquireOAuth2V1AuthorizationToken(resourceCode: Code[20]; clientCode: Code[20];prompt: Enum "Prompt Interaction"; origin: Enum "M365 Authorization Origin"; var returnAccessToken: Text): Boolean
Gets the authorization token based on the authorization code via the OAuth2 v1.0 code grant flow. If an error occurs and the procedure returns false, use GetAndClearLastError() to get the complete error message.
resourceCode Code[20]
The Code for a resource to get authorization for.
clientCode Code[20]
The Code for a defined M365 Client Authorization record.
prompt Enum "Prompt Interaction"
Select the interaction prompt used for this OAuth2 2.0 request.
origin Enum "M365 Authorization Origin"
Specify if the token should be qcquired from cache, authority or both with fallback.
returnAccessToken Text
If successful, the authorization access token is returned here.
Returns Boolean
True if authorization succeeded, false otherwise.
procedure AcquireOAuth2V1AuthorizationToken(resourceCode: Code[20]; clientCode: Code[20];prompt: Enum "Prompt Interaction"; origin: Enum "M365 Authorization Origin"; var returnAccessToken: SecretText): Boolean
Gets the authorization token based on the authorization code via the OAuth2 v1.0 code grant flow. If an error occurs and the procedure returns false, use GetAndClearLastError() to get the complete error message.
resourceCode Code[20]
The Code for a resource to get authorization for.
clientCode Code[20]
The Code for a defined M365 Client Authorization record.
prompt Enum "Prompt Interaction"
Select the interaction prompt used for this OAuth2 2.0 request.
origin Enum "M365 Authorization Origin"
Specify if the token should be qcquired from cache, authority or both with fallback.
returnAccessToken SecretText
If successful, the authorization access token is returned here.
Returns Boolean
True if authorization succeeded, false otherwise.
procedure AcquireOAuth2V2AuthorizationToken(resourceCode: Code[20]; clientCode: Code[20];prompt: Enum "Prompt Interaction"; origin: Enum "M365 Authorization Origin"; var returnAccessToken: Text): Boolean
Gets the authorization token based on the authorization code via the OAuth2 v2.0 code grant flow. If an error occurs and the procedure returns false, use GetAndClearLastError() to get the complete error message.
resourceCode Code[20]
The Code for a resource to get authorization for.
clientCode Code[20]
The Code for a defined M365 Client Authorization record.
prompt Enum "Prompt Interaction"
Select the interaction prompt used for this OAuth2 2.0 request.
origin Enum "M365 Authorization Origin"
Specify if the token should be qcquired from cache, authority or both with fallback.
returnAccessToken Text
If successful, the authorization access token is returned here.
Returns Boolean
True if authorization succeeded, false otherwise.
procedure AcquireOAuth2V2AuthorizationToken(resourceCode: Code[20]; clientCode: Code[20];prompt: Enum "Prompt Interaction"; origin: Enum "M365 Authorization Origin"; var returnAccessToken: SecretText): Boolean
Gets the authorization token based on the authorization code via the OAuth2 v2.0 code grant flow. If an error occurs and the procedure returns false, use GetAndClearLastError() to get the complete error message.
resourceCode Code[20]
The Code for a resource to get authorization for.
clientCode Code[20]
The Code for a defined M365 Client Authorization record.
prompt Enum "Prompt Interaction"
Select the interaction prompt used for this OAuth2 2.0 request.
origin Enum "M365 Authorization Origin"
Specify if the token should be qcquired from cache, authority or both with fallback.
returnAccessToken SecretText
If successful, the authorization access token is returned here.
Returns Boolean
True if authorization succeeded, false otherwise.
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.