---
title: "Codeunit 1140 OAuth 2.0 Mgt."
author: "Jonas Paprotka"
url: https://jonas-paprotka.de/ref/codeunit/1140-oauth-2-0-mgt/
type: codeunit
id: 1140
name: "OAuth 2.0 Mgt."
app: "Base Application"
namespace: System.Security.Authentication
versions: "17-28"
build: 28.5.54151.54365
source: "https://jonas-paprotka.de/ref/codeunit/1140-oauth-2-0-mgt/source/29/"
checked: 2026-09-20
subject: "Microsoft Dynamics 365 Business Central"
license: "Content © 2026 Jonas Paprotka. Quote freely with attribution and a link."
---

# Codeunit 1140 OAuth 2.0 Mgt.

Jonas Paprotka, https://jonas-paprotka.de/ref/codeunit/1140-oauth-2-0-mgt/

| | |
| --- | --- |
| App | Base Application |
| Namespace | System.Security.Authentication |
| Versions | 17-28 |
| Source file | System/OAuth/OAuth20Mgt.Codeunit.al |

## Procedures

| Name | Parameters | Returns | Access | Versions | Obsolete | Reason |
| --- | --- | --- | --- | --- | --- | --- |
| RequestAuthFromNotification | (Notification) | - | public | 17-28 | - | - |
| GetAuthorizationURL | (Record OAuth 2.0 Setup, Text) | Text | public | 17-26 | Pending 24.0 | Use procedure GetAuthorizationURLAsSecretText instead. |
| RequestAccessToken | (var Record OAuth 2.0 Setup, var Text, Text, Text, Text, var Text, var Text) | Boolean | public | 17-26 | Pending 24.0 | Use RequestAccessToken procedure with parameters declared as SecretText instead. |
| RequestAccessTokenWithGivenRequestJson | (var Record OAuth 2.0 Setup, Text, var Text, Text, Text, Text, var Text, var Text) | Boolean | public | 17-26 | Pending 24.0 | Use RequestAccessTokenWithGivenRequestJson with paramaters declared as SecretText instead. |
| RequestAccessTokenWithContentType | (var Record OAuth 2.0 Setup, Text, var Text, Text, Text, Text, var Text, var Text, Boolean) | Boolean | public | 17-26 | Pending 24.0 | Use "RequestAccessTokenWithContentType with paramaters declared as SecretText instead. |
| RefreshAccessToken | (var Record OAuth 2.0 Setup, var Text, Text, Text, var Text, var Text) | Boolean | public | 17-26 | Pending 24.0 | Use RefreshAccessToken with paramaters declared as SecretText instead. |
| RefreshAccessTokenWithGivenRequestJson | (var Record OAuth 2.0 Setup, Text, var Text, Text, Text, var Text, var Text) | Boolean | public | 17-26 | Pending 24.0 | Use RefreshAccessTokenWithGivenRequestJson with paramaters declared as SecretText instead. |
| RefreshAccessTokenWithContentType | (var Record OAuth 2.0 Setup, Text, var Text, Text, Text, var Text, var Text, Boolean) | Boolean | public | 17-26 | Pending 24.0 | Use RefreshAccessTokenWithContentType with paramaters declared as SecretText instead. |
| InvokeRequest | (var Record OAuth 2.0 Setup, Text, var Text, var Text, Text, Boolean) | Boolean | public | 17-26 | Pending 24.0 | Use InvokeRequest with paramaters declared as SecretText instead. |
| RequestAuthorizationCode | (Record OAuth 2.0 Setup) | - | public | 17-28 | - | - |
| RequestAndSaveAccessToken | (var Record OAuth 2.0 Setup, var Text, Text) | Boolean | public | 17-26 | Pending 24.0 | Use RequestAndSaveAccessToken with paramaters declared as SecretText instead. |
| RefreshAndSaveAccessToken | (var Record OAuth 2.0 Setup, var Text) | Boolean | public | 17-28 | - | - |
| InvokeRequestBasic | (var Record OAuth 2.0 Setup, Text, var Text, var Text, Boolean) | Boolean | public | 17-28 | - | - |
| CheckEncryption | () | - | public | 17-28 | - | - |
| GetHttpStatusFromJsonResponse | (Text, var Integer, var Text, var Text) | Boolean | public | 17-28 | - | - |
| GetAuthorizationURLAsSecretText | (Record OAuth 2.0 Setup, Text) | SecretText | public | 24-28 | - | - |
| RequestAccessToken | (var Record OAuth 2.0 Setup, var Text, SecretText, Text, SecretText, var SecretText, var SecretText) | Boolean | public | 24-28 | - | - |
| RequestAccessTokenWithGivenRequestJson | (var Record OAuth 2.0 Setup, Text, var Text, SecretText, Text, SecretText, var SecretText, var SecretText) | Boolean | public | 24-28 | - | - |
| RequestAccessTokenWithContentType | (var Record OAuth 2.0 Setup, Text, var Text, SecretText, Text, SecretText, var SecretText, var SecretText, Boolean) | Boolean | public | 24-28 | - | - |
| RefreshAccessToken | (var Record OAuth 2.0 Setup, var Text, Text, SecretText, var SecretText, var SecretText) | Boolean | public | 24-28 | - | - |
| RefreshAccessTokenWithGivenRequestJson | (var Record OAuth 2.0 Setup, Text, var Text, Text, SecretText, var SecretText, var SecretText) | Boolean | public | 24-28 | - | - |
| RefreshAccessTokenWithContentType | (var Record OAuth 2.0 Setup, Text, var Text, Text, SecretText, var SecretText, var SecretText, Boolean) | Boolean | public | 24-28 | - | - |
| InvokeRequest | (var Record OAuth 2.0 Setup, Text, var Text, var Text, SecretText, Boolean) | Boolean | public | 24-28 | - | - |
| RequestAndSaveAccessToken | (var Record OAuth 2.0 Setup, var Text, SecretText) | Boolean | public | 24-28 | - | - |

## Events

| Kind | Name | Parameters | Versions | Obsolete | Reason |
| --- | --- | --- | --- | --- | --- |
| Integration event | OnBeforeCheckEncryption | (var Boolean) | 19-28 | - | - |
| Integration event | OnBeforeGetServiceUrlForAuthorizationURL | (var Text, Record OAuth 2.0 Setup) | 23-28 | - | - |

## Source

Symbols: Microsoft.BaseApplication.symbols.437dbf0e-84ff-417a-965d-ed2bb9650972, https://dynamicssmb2.pkgs.visualstudio.com/DynamicsBCPublicFeeds/_packaging/MSSymbols/nuget/v3/index.json, highest build per major on 2026-09-20.
AL source 29: https://github.com/microsoft/BCApps, MIT, releases/29.x at a66254c3b8b5bb1cea290dc8f9d097aec4381153.

Jonas Paprotka, 2026-09-20.
