community postIntegration & APIscommunity - not Microsoftreviewed - checked by Opus

OAuth library for the Rest Client

An OAuth library for Business Central's Rest Client module has been released on GitHub, supporting both Authorization Code Grant and Client Credentials flows with AL code, certificates, and Azure Entra ID integration. Use this when you need flexible OAuth authentication without .NET dependencies or complex function overloading.

post Kauffmann @ Dynamics 365 Business Central

Arend-Jan Kauffmann · 2025-09-02 · 684 words · about 3 min

"The OAuth library I'm introducing now uses no .NET components. It's entirely written in AL code."

Key points

  • Pure AL implementation with no .NET components, making the code more transparent and maintainable
  • Supports two OAuth flows: Authorization Code Grant (with automatic token refresh) and Client Credentials (service-to-service)
  • Features certificate-based authentication with easy certificate generation and download via a dedicated page
  • Includes security measures like PKCE and state parameters to prevent CSRF attacks
  • Available on GitHub under MIT license with extensibility for other authorities beyond Azure Entra ID

Quotes

  • “The OAuth library I’m introducing now uses no .NET components. It’s entirely written in AL code.” (This transparency and AL-only approach makes the code more maintainable and easier to understand compared to the existing OAuth2 module which relies on complex .NET calls.)
  • “Support for both Authorization Code Grant flow and Client Credentials flow.” (This dual support covers both interactive user authentication scenarios and automated service-to-service integration patterns.)

AL objects mentioned

As named in the post. A name that matches one object page by exact type and name links to it; the others stay as named.

  • other “Rest Client module”
  • other “OAuth2 module”
  • other “Endpoint/OAuth management module”

Context

  • Features: OAuth Authorization Code Grant flow, OAuth Client Credentials flow, Certificate-based authentication, Token automatic refresh, PKCE and state parameters, Self-hosted OAuth landing page, Azure Entra ID support, Endpoint management
  • Versions: v28

Source: Kauffmann @ Dynamics 365 Business Central, community blog. Summary, key points and quotes are derived (CONTENT-NOTICE.md); read the original for the full text.