code change · fixPlatform, DevOps & Performanceofficial - Microsoftreviewed - checked by Opus

#10481 [Bug Fix] #251: Handle GetUserName TryFunction failure during OAuth validation

Fixed OAuth2 SMTP authentication to properly handle token parsing failures by consuming the TryFunction return value, preventing raw errors from being shown to users instead of the authentication-failed message.

Pull request · merged into main (BC30) on 2026-10-14 by ventselartur · 2 files (+37 -3), 1 AL · fix · tier official · reviewed (checked by Opus)

What changed

  • CheckOAuth2Authentication now uses the GetUserName TryFunction result and shows AuthenticationFailedMsg when token parsing fails
  • GetOAuth2Credentials now raises CouldNotAuthenticateErr when parsing fails, instead of continuing with an empty user name
  • Raw runtime parse errors are no longer shown to users
  • Adds a regression test for an unparseable token in SMTP Account Auth Tests
  • Behaviour changes for users or extensions.

AL objects touched

Context

  • Work items: AB#646834
  • Labels: AL: Apps (W1), Team: Integrations
  • Systems: platform

No source states these links: they share an object, a model read them, or a person found the same subject.

  • Handling errors using try methods — possibly related: Documents try methods and error handling during code execution, core to handling GetUserName TryFunction failure. (model-linked)

Source: metadata of a merged pull request in microsoft/BCApps (bcapps): title, labels, changed paths and counts, with a summary in our words. No source text and no description beyond one short quote (D10, D61).