Skip to content

Unauthorized Client Error in Office-Add-in-NodeJS-SSO Sample When Trying to Get OneDrive File Names #1019

@CodeWithAbuBakr

Description

@CodeWithAbuBakr

Title: unauthorized_client error in Office-Add-in-NodeJS-SSO sample when clicking "Get OneDrive File Names" button

Provide required information needed to triage your issue
Your Environment
Platform: PC desktop

Host: Excel

Office version number: Microsoft 365 Version 2406 (Build 17726.20126)

Operating System: Windows 10

Browser (if using Office on the web): N/A

Expected behavior
Clicking "Get OneDrive File Names" should authenticate the user and display a list of filenames from their OneDrive account.

Current behavior:

Instead of retrieving the file names, a dialog appears with the following error message:
"unauthorized_client: The client does not exist or is not enabled for consumers.
If you are the application developer, configure a new application through the
App Registrations in the Azure Portal at https://go.microsoft.com/fwlink/?linkid=2083908."

Steps to reproduce
1: Clone the sample repo: https://github.com/OfficeDev/Office-Add-in-samples/tree/main/Samples/auth/Office-Add-in-NodeJS-SSO

2: Set up the .env file with the following values (masked sensitive info):

CLIENT_ID=#####################
CLIENT_SECRET=#####################
NODE_ENV=development
SERVER_SOURCE=https://localhost:3000
TENANT_ID=#####################
REDIRECT_URI=https://localhost:3000/auth/callback
SCOPES=User.Read Files.Read

  1. Install dependencies and run the Node.js server

  2. Sideload the manifest in Excel (using a shared folder)

  3. Launch the add-in and click "Get OneDrive File Names"

  4. Office dialog opens and shows the unauthorized_client error

Link to live example(s)
N/A – this issue is from a local setup using the official sample

Provide additional details
Azure app registration was completed

Redirect URI https://localhost:3000/auth/callback is added under platform "Web"

API permissions for User.Read and Files.Read are granted with admin consent

Application type is set to “Accounts in this organizational directory only (Single tenant)”

Context
I’m evaluating the Office-Add-in SSO flow for a production Excel add-in. This error blocks the flow after clicking the OneDrive button, so I can’t complete SSO or test file access.

Useful logs
Console errors (from Office dialog):
unauthorized_client: The client does not exist or is not enabled for consumers.

Image

Screenshot: (Attached when creating GitHub issue)

Test file: N/A

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions