{"title":"Codeunit 1140 OAuth 2.0 Mgt., extension points 29","url":"https://jonas-paprotka.de/ref/codeunit/1140-oauth-2-0-mgt/points/","author":"JOP-AL","license":"Metadata from Microsoft's symbol packages. AL source MIT, Copyright (c) Microsoft Corporation. Selection and wording © 2026 JOP-AL. https://jonas-paprotka.de/licenses/","subject":"Microsoft Dynamics 365 Business Central","checked":"2026-11-20","changed":"2026-10-05","object":{"type":"codeunit","id":1140,"name":"OAuth 2.0 Mgt.","app":"Base Application","url":"https://jonas-paprotka.de/ref/codeunit/1140-oauth-2-0-mgt/"},"major":29,"source":{"url":"https://jonas-paprotka.de/ref/codeunit/1140-oauth-2-0-mgt/source/","path":"src/Layers/W1/BaseApp/System/OAuth/OAuth20Mgt.Codeunit.al","commit":"4303e5e584d3aa5d9e98cbc615525a5396ad6ed7","lines":"a line is <source url>#L<line>"},"steps":{"event":"[line, \"event\", name, handled]: raises an event of this object; handled 1 when it has an IsHandled parameter","call":"[line, \"call\", name, arguments]: calls a procedure of this object","ext":"[line, \"ext\", type, id, name, arguments]: calls a procedure of another object, through a variable declared with that type","write":"[line, \"write\", table id, method, 1 when called with true]: Insert, Modify, ModifyAll, Delete, DeleteAll or Rename","validate":"[line, \"validate\", table id, field name]","run":"[line, \"run\", type, id]: Codeunit.Run, Page.Run, Report.Run and their kin"},"objects":{"table:1140":{"name":"OAuth 2.0 Setup","url":"https://jonas-paprotka.de/ref/table/1140-oauth-2-0-setup/"},"codeunit:457":{"name":"Environment Information","url":"https://jonas-paprotka.de/ref/codeunit/457-environment-information/"},"page:9905":{"name":"Data Encryption Management","url":"https://jonas-paprotka.de/ref/page/9905-data-encryption-management/"},"table:710":{"name":"Activity Log","url":"https://jonas-paprotka.de/ref/table/710-activity-log/"},"codeunit:4110":{"name":"Base64 Convert","url":"https://jonas-paprotka.de/ref/codeunit/4110-base64-convert/"},"codeunit:1266":{"name":"Cryptography Management","url":"https://jonas-paprotka.de/ref/codeunit/1266-cryptography-management/"}},"procs":[{"name":"OnAfterGetCurrRecordPageEvent","line":39,"kind":"procedure","access":"local","params":1,"steps":[[43,"call","GetRequestAuthNotificationGUID",0]]},{"name":"RequestAuthFromNotification","line":57,"kind":"procedure","params":1,"steps":[[67,"ext","table",1140,"RequestAuthorizationCode",0]]},{"name":"GetAuthorizationURLAsSecretText","line":75,"kind":"procedure","params":2,"steps":[[89,"call","LogActivity",7],[91,"event","OnBeforeGetServiceUrlForAuthorizationURL",0],[96,"call","ExtendAuthorizationURLWithCodeChallenge",2],[97,"call","ExtendWithNonce",2]]},{"name":"RequestAccessToken","line":105,"kind":"procedure","params":7,"steps":[[108,"call","RequestAccessTokenWithGivenRequestJson",8]]},{"name":"RequestAccessTokenWithGivenRequestJson","line":116,"kind":"procedure","params":8,"steps":[[118,"call","RequestAccessTokenWithGivenRequestJsonAndContentType",9]]},{"name":"RequestAccessTokenWithContentType","line":125,"kind":"procedure","params":9,"steps":[[127,"call","RequestAccessTokenWithGivenRequestJsonAndContentType",9]]},{"name":"RequestAccessTokenWithGivenRequestJsonAndContentType","line":130,"kind":"procedure","access":"local","params":9,"steps":[[146,"call","CreateContentRequestForAccessToken",6],[146,"ext","table",1140,"GetTokenAsSecretText",1],[147,"call","CreateRequestJSONForAccessRefreshTokenUrlEncoded",5],[149,"call","CreateContentRequestJSONForAccessToken",6],[149,"ext","table",1140,"GetTokenAsSecretText",1],[150,"call","CreateRequestJSONForAccessRefreshToken",5],[153,"call","RequestAccessAndRefreshTokens",6],[154,"call","SaveResultForRequestAccessAndRefreshTokens",10]]},{"name":"RefreshAccessToken","line":164,"kind":"procedure","params":6,"steps":[[167,"call","RefreshAccessTokenWithGivenRequestJson",7]]},{"name":"RefreshAccessTokenWithGivenRequestJson","line":175,"kind":"procedure","params":7,"steps":[[177,"call","RefreshAccessTokenWithGivenRequestJsonAndContentType",8]]},{"name":"RefreshAccessTokenWithContentType","line":184,"kind":"procedure","params":8,"steps":[[186,"call","RefreshAccessTokenWithGivenRequestJsonAndContentType",8]]},{"name":"RefreshAccessTokenWithGivenRequestJsonAndContentType","line":189,"kind":"procedure","access":"local","params":8,"steps":[[205,"call","CreateContentRequestForRefreshAccessToken",4],[206,"call","CreateRequestJSONForAccessRefreshTokenUrlEncoded",5],[208,"call","CreateContentRequestJSONForRefreshAccessToken",4],[209,"call","CreateRequestJSONForAccessRefreshToken",5],[212,"call","RequestAccessAndRefreshTokens",6],[213,"call","SaveResultForRequestAccessAndRefreshTokens",10]]},{"name":"SaveResultForRequestAccessAndRefreshTokens","line":218,"kind":"procedure","access":"local","params":10,"steps":[[231,"call","LogActivity",7]]},{"name":"InvokeRequest","line":234,"kind":"procedure","params":6,"steps":[[242,"ext","table",1140,"RefreshAccessToken",1],[243,"ext","table",1140,"InvokeRequest",4],[247,"call","InvokeSingleRequest",5],[249,"call","GetHttpStatusFromJsonResponse",4],[251,"ext","table",1140,"RefreshAccessToken",1],[252,"ext","table",1140,"InvokeRequest",4]]},{"name":"RequestAuthorizationCode","line":257,"kind":"procedure","params":1,"steps":[[259,"call","GetAuthorizationURLAsSecretText",2],[259,"ext","table",1140,"GetTokenAsSecretText",1]]},{"name":"RequestAndSaveAccessToken","line":265,"kind":"procedure","params":3,"steps":[[271,"call","RequestAccessToken",7],[273,"ext","table",1140,"GetTokenAsSecretText",1],[273,"ext","table",1140,"GetTokenAsSecretText",1],[277,"call","SaveTokens",3]]},{"name":"RefreshAndSaveAccessToken","line":282,"kind":"procedure","params":2,"steps":[[287,"ext","table",1140,"GetTokenAsSecretText",1],[289,"call","RefreshAccessToken",6],[291,"ext","table",1140,"GetTokenAsSecretText",1],[291,"ext","table",1140,"GetTokenAsSecretText",1],[295,"call","SaveTokens",3]]},{"name":"InvokeRequestBasic","line":300,"kind":"procedure","params":5,"steps":[[303,"call","InvokeRequest",6],[305,"ext","table",1140,"GetTokenAsSecretText",1]]},{"name":"CheckEncryption","line":309,"kind":"procedure","params":0,"steps":[[314,"event","OnBeforeCheckEncryption",1],[317,"ext","codeunit",457,"IsSaaS",0],[319,"run","page",9905]]},{"name":"InvokeSingleRequest","line":322,"kind":"procedure","access":"local","params":5,"steps":[[348,"call","InvokeHttpJSONRequest",3],[357,"call","LogActivity",7]]},{"name":"SaveTokens","line":363,"kind":"procedure","access":"local","params":3,"steps":[[365,"ext","table",1140,"SetToken",2],[366,"ext","table",1140,"SetToken",2],[367,"write",1140,"Modify"]]},{"name":"RequestAccessAndRefreshTokens","line":371,"kind":"procedure","access":"local","params":6,"steps":[[385,"call","InvokeHttpJSONRequest",3],[386,"call","ParseAccessAndRefreshTokens",4]]},{"name":"LogActivity","line":517,"kind":"procedure","access":"local","params":7,"steps":[[537,"ext","table",710,"LogActivity",5],[538,"call","MaskHeaders",1],[555,"ext","table",710,"SetDetailedInfoFromText",1],[557,"write",1140,"Modify"]]},{"name":"InvokeHttpJSONRequest","line":612,"kind":"procedure","access":"local","params":3,"steps":[[626,"call","InitHttpRequestContent",2],[627,"call","InitHttpRequestMessage",2],[638,"call","ProcessHttpResponseMessage",3]]},{"name":"ProcessHttpResponseMessage","line":710,"kind":"procedure","access":"local","params":3,"steps":[[741,"call","SetHttpStatus",4]]},{"name":"ExtendAuthorizationURLWithCodeChallenge","line":746,"kind":"procedure","access":"local","params":2,"steps":[[752,"call","GenerateRandomCodeVerifier",0],[753,"ext","table",1140,"SetToken",2],[754,"write",1140,"Modify",1],[755,"call","GenerateCodeChallenge",2]]},{"name":"ExtendWithNonce","line":759,"kind":"procedure","access":"local","params":2,"steps":[[762,"call","GenerateRandomCodeVerifier",0]]},{"name":"GenerateRandomCodeVerifier","line":767,"kind":"procedure","access":"local","params":0,"steps":[[771,"call","Encode",1],[771,"ext","codeunit",4110,"ToBase64",1]]},{"name":"GenerateCodeChallenge","line":775,"kind":"procedure","access":"local","params":2,"steps":[[781,"call","Encode",1],[781,"ext","codeunit",1266,"GenerateHashAsBase64String",2]]}]}