Clarification on Redirect URI for OneDrive Authentication

I am developing a custom app to read a file from my OneDrive.

To authenticate with Microsoft and access the file, I need to configure a redirect URI. I have configured the following redirect URIs in the Azure App Registration:

  • Local: http://localhost:10001/auth/callback
  • Production: https://oauth.freshdev.io/auth/callback

However, the authentication is not working, and I’m encountering an “Invalid state” error during the callback.

Could you please confirm whether these are the correct redirect URIs to use for a Freshworks custom app? Or should I configure the following URL as the redirect URI instead?d3h0owdjgzys62.cloudfront.net

Thanks,
Pavithra Selvaraj

Can you share the url to which the callback redirects with the query param as well ?

The redirect url seems to be correct though

https://d3h0owdjgzys62.cloudfront.net this was redirect url we have configured.

https://d3h0owdjgzys62.cloudfront.net is this correct one.?

When configuring Microsoft Entra ID (Azure AD) OAuth for Freshworks apps (both local FDK testing and production deployment on oauth.freshdev.io), there are three common pitfalls that trigger authorization failures:

  1. Platform Configuration in Entra ID (Web vs SPA):
    In Azure App Registration under Authentication → Add a platform, ensure you add Web and NOT Single Page Application (SPA). The Freshworks OAuth service (oauth.freshdev.io) performs the token exchange via authorization code grant on the backend server, so selecting SPA will cause Microsoft to reject client secret authentication during the token handshake.

  2. Redirect URI Formatting & Trailing Slashes:
    Azure is strictly case-sensitive and character-exact regarding reply URLs. Ensure both entries are saved exactly as:

  • Local testing: http://localhost:10001/auth/callback
  • Production: https://oauth.freshdev.io/auth/callback
    (Make sure there is no trailing slash / at the end of callback).
  1. Mandatory offline_access in Scope (oauth_config.json):
    For Microsoft Graph API, if offline_access is not explicitly included in the scopes, Microsoft will only return an access_token without a refresh_token. The Freshworks OAuth broker requires a refresh_token to persist the session and refresh expired tokens automatically; without it, the callback will fail with a generic token handling error.

Double-check your config/oauth_config.json:

  • authorize_url: https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize
  • token_url: https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token
  • token_type: "account" (or "agent")
  • options.scope: "offline_access Files.Read Files.ReadWrite User.Read"

If you are using a multi-tenant or personal account setup, ensure {tenant} is set to common or consumers, otherwise use your specific Entra Tenant Directory ID.

No, the CloudFront URL (d3h0owdjgzys62.cloudfront.net) is only the static asset CDN where Freshworks hosts your custom app front-end files, not the OAuth callback endpoint.

In your Microsoft Entra (Azure AD) app registration, the Redirect URI must be set to https://oauth.freshdev.io/auth/callback for production and http://localhost:10001/auth/callback for local FDK testing.

Thanks for the response