---
id: change/bcapps/12140
type: change
title: "#12140 [Email - SMTP Connector] Fix OAuth Base64URL token parsing"
summary: OAuth2 SMTP authentication now correctly decodes Base64URL tokens by normalizing them to standard Base64 before parsing, fixing intermittent authentication failures when JWT payloads contain URL-safe characters.
tier: official
language: en
tags:
  - fix
  - main
  - bc30
  - codeunit oauth2 smtp authentication
system: development
review:
  state: reviewed
  by: opus
  at: "2026-10-08T02:02:45.616Z"
  flags: []
generated:
  at: "2026-10-08T01:26:53.141Z"
  pipeline: 0.2.0
  prompts:
    extract-change: 1
  input_hash: 9e22089048684b3971d19dc52ab89d8fae4345af
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/pull/12140
    title: "microsoft/BCApps#12140: [Email - SMTP Connector] Fix OAuth Base64URL token parsing"
    date: "2026-10-01"
    commit: 9e22089048684b3971d19dc52ab89d8fae4345af
    t: null
    quote: Normalize the OAuth access-token payload from Base64URL to standard Base64 before decoding it.
links:
  learn: []
  objects:
    - object/codeunit/4516
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
  changes: []
number: 12140
repo: microsoft/BCApps
source_id: bcapps-prs
url: https://github.com/microsoft/BCApps/pull/12140
kind: pr
base_branch: main
major: "30"
merged_at: "2026-10-01T16:25:47Z"
author: onbuyuka
author_type: User
community_contribution: false
labels:
  - "AL: Apps (W1)"
  - "Team: Integrations"
change_class: code
change_kind: fix
behavior_change: true
breaking: false
files:
  count: 2
  additions: 16
  deletions: 1
  al: 1
apps:
  - Email - SMTP Connector
objects_touched:
  - key: codeunit/4516
    page: codeunit/4516
    type: codeunit
    id: 4516
    name: OAuth2 SMTP Authentication
    app: Email - SMTP Connector
    status: modified
objects_unjoined: []
obsoletions: []
backports: []
fixes_issues: []
work_items:
  - 652319
systems:
  - development
quote: Normalize the OAuth access-token payload from Base64URL to standard Base64 before decoding it.
joined_against:
  major: "30"
  commit: ecbc028c25dbe83b61313bc566e6c1d41184bb1c
---

# #12140 [Email - SMTP Connector] Fix OAuth Base64URL token parsing

> OAuth2 SMTP authentication now correctly decodes Base64URL tokens by normalizing them to standard Base64 before parsing, fixing intermittent authentication failures when JWT payloads contain URL-safe characters.

[Pull request](https://github.com/microsoft/BCApps/pull/12140) · merged into `main` (BC30) on 2026-10-01 by onbuyuka · 2 files (+16 -1), 1 AL · fix · tier official · reviewed (checked by Opus)

## What changed

- Base64URL tokens are converted to standard Base64 format before decoding
- Fixes authentication failures when JWT payload contains '-' or '_' characters
- Regression test added to cover Base64URL-specific characters
- Existing username extraction and authentication flow unchanged
- Resolves issue where standard Base64 decoder raised invalid encoding errors
- Behaviour changes for users or extensions.

## AL objects touched

- [Codeunit 4516 "OAuth2 SMTP Authentication"](../../objects/codeunit/4516.md), Email - SMTP Connector: modified

## Context

- Work items: AB#652319
- Labels: AL: Apps (W1), Team: Integrations
- Systems: development
- From the description: "Normalize the OAuth access-token payload from Base64URL to standard Base64 before decoding it."

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).
