Dive into deep insights and technical expertise 😎

Sunday, November 30, 2025

Ultimate Troubleshooting Guide: Fixing ServiceNow + OneDrive OAuth, Token, and Folder Path Issues

Ultimate Troubleshooting Guide: Fixing ServiceNow + OneDrive OAuth, Token, and Folder Path Issues

Ultimate Troubleshooting Guide: Fixing ServiceNow + OneDrive OAuth & Folder Path Issues

ServiceNow’s integration with Microsoft OneDrive often works flawlessly—until it doesn’t.
Admins frequently see issues like:

  • Files uploaded into the wrong user’s OneDrive folder

  • Tokens regenerating but not applying properly

  • “OAuth access or refresh token not available”

  • OneDrive Spoke actions failing silently

  • No prompt for Microsoft login when clicking Get OAuth Token

This troubleshooting guide gives you precise workflows to identify and resolve root causes.

1. Verify You Are Using the Right OAuth Profile

Go to:

System OAuth → Application Registry

Confirm that:

✔ Only one OneDrive OAuth application exists
✔ Its Client ID matches Azure App Registration
✔ Its Client Secret is valid
✔ Grant Type = Authorization Code (required for OneDrive Spoke)

If there are duplicate profiles → delete or deactivate the unused ones.

2. Confirm You Are Clicking “Get OAuth Token” Under the Correct Credential

Navigate to:

Connections & Credentials → Credentials → (Your OneDrive Spoke Credential)

Then:

✔ Ensure this credential uses the same OAuth profile
✔ Ensure your connection record uses this credential
✔ Click Get OAuth Token only after logging in with the correct Microsoft user

3. Verify Microsoft Session Identity (THE #1 FAILURE POINT)

Go to https://myaccount.microsoft.com and confirm:

✔ Who is currently logged in?
✔ Is Teams logged in?
✔ Is Outlook logged in?
✔ Is OneDrive sync client logged in?

Incorrect account = incorrect OAuth token.

4. Fix Token Ownership: Generate Token for the Right OneDrive Account

To issue the correct token:

  1. Sign out from all Microsoft apps

  2. Clear browser cookies + cache

  3. Open a new incognito window

  4. Sign in to Microsoft as the intended OneDrive service account

  5. Log in to ServiceNow as the same account

  6. Click Get OAuth Token

If it still uses the wrong account:
– Use a different browser
– Use a clean VM
– Use a private Windows profile
– Disable “Windows Account Manager” in Edge settings

5. Test OneDrive Spoke Connectivity

Test using:

OneDriveList Drive Items

✔ If results come from the wrong drive → wrong token
✔ If unauthorized → wrong permissions
✔ If empty → token is correct but folder path is wrong

6. Validate Graph Permissions

Your Azure App Registration must include:

Delegated permissions:

  • Files.ReadWrite.All

  • Files.Read.All

  • User.Read

  • offline_access

And admin consent must be granted:

Azure portal → App Registration → API Permissions → Grant admin consent

If consent is missing, tokens will work but operations silently fail.

7. Confirm the OneDrive Service Account Actually Has OneDrive Enabled

Go to the Microsoft Admin Center:

✔ The account must have a valid OneDrive license
✔ It must have logged in to OneDrive at least once
✔ Storage must be provisioned

If not, OneDrive Spoke will fail with misleading errors.

8. Check Whether the Token Belongs to the Wrong User in ServiceNow

Find token owner:

sys_oauth_credential.do

Look at the field:

Authorized by User

If this shows Hoff, admin, or any user except your service account → wrong identity is issuing the token.

9. Verify the Document Path Logic in ServiceNow

For Document Services:

Navigate to:

Document Management → Connection Configuration → OneDrive Settings

Check:

✔ Default folder
✔ Path variable mapping
✔ Whether a user-specific folder is enforced
✔ Whether the integration uses SharePoint or personal OneDrive

10. Reset Token If Needed

If things are completely broken:

  1. Remove OAuth tokens from sys_oauth_credential

  2. Remove token from OneDrive Spoke credential

  3. Restart token flow (following Step 4)

Summary Checklist

Issue

Likely Cause

Files going to wrong OneDrive user

Microsoft session mismatch

No Microsoft login prompt

SSO or cached session

OAuth token unavailable

Client secret mismatch / expired token

OneDrive Spoke failing

Missing Graph permissions

Token stored under wrong ServiceNow user

Wrong login identity during OAuth

Files uploading but not into correct path

Incorrect folder mapping


Share:

0 comments:

Post a Comment

InformativeTechnicalContent.com