Codeunit 5505379 M365 Authorization Management
Codeunit 5505379 M365 Authorization Management
Management Codeunit to handle OAuth2 authorization based on configuration.
Methods
ValidateUrl
procedure ValidateUrl(url: Text)
Validate an url for correct format.
Parameters / Return Value
url
Text[]Complete url.
GetAndClearLastError
procedure GetAndClearLastError(): Text
Returns and clears the last stored error.
Parameters / Return Value
Returns
Text[]Last error text.
AcquireOAuth2V1AuthorizationToken
Obsolete
Pending: Use AcquireOAuth2V1AuthorizationToken with SecretText data type for returnAccessToken. (24.0)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.
Parameters / Return Value
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
BooleanTrue if authorization succeeded, false otherwise.
AcquireOAuth2V1AuthorizationToken
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.
Parameters / Return Value
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
SecretTextIf successful, the authorization access token is returned here.
Returns
BooleanTrue if authorization succeeded, false otherwise.
AcquireOAuth2V2AuthorizationToken
Obsolete
Pending: Use AcquireOAuth2V2AuthorizationToken with SecretText data type for returnAccessToken. (24.0)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.
Parameters / Return Value
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
BooleanTrue if authorization succeeded, false otherwise.
AcquireOAuth2V2AuthorizationToken
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.
Parameters / Return Value
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
SecretTextIf successful, the authorization access token is returned here.
Returns
BooleanTrue if authorization succeeded, false otherwise.
Feedback
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.