Sign in Azure AD using AppAuth

I’ve opened a topic before for using the expo-app-auth package with Microsoft Azure Login but did not get any solution. Link to the previous topic: Sign in Azure AD using AppAuth package

But now I was able to get the package to work with Microsoft Provider (hotmail, outlook, live …)

The problem was that the Microsoft APIs were not updated to version 2. And here’s the code for the access token response:

const tokenResponse = await AppAuth.authAsync({
issuer: “”,
redirectUrl: AppAuth.OAuthRedirect + ‘://oauthredirect’,
scopes: [

This redirect URI is for the Expo Client apps (should be added also in the Azure App Redirect URIs), but in case of standalone apps, it is either the android.package (for Android) or ios.bundleIdentifier (for iOS) value from your app.json. Check the package documentation. The scopes also are according to the required access for your application.

Hope this post helps! :slight_smile:

1 Like

Working Fine, what error are you facing?

Hi Onaggar, thanks for sharing it.

I’m facing this error bellow, do you have any idea how to solve it?

ERR_APP_AUTH: JSON error parsing document at ‘’: Invalid URL: issuer

My config settings are:
const microsoftConfig = {
issuer: ‘’,
clientId: microsoft_id,
clientSecret: microsoft_secret,
redirectUrl: ${AppAuth.OAuthRedirect}://oauthredirect,
scopes: [‘openid’, ‘profile’, ‘offline_access’, ‘’],

Thanks in advance.

Did you add “host.exp.exponent://oauthredirect” to your Azure Application Redirect URIs ?

Yep, also tried adding others uri too but nothing worked =/

I changed the issuer to:${tenant_id}/v2.0/, and now the popup appears, but nothing returns after I accept the login

I don’t know if you ever resolved this, but I am posting this for anyone else that has wrestled with it.

I also wasn’t getting a response after login, so I changed the redirect URL.

What seems to work for me in development in the expo app is:

Azure Portal redirect:
App redirect:

If Microsoft doesn’t allow you to use that from their interface, edit the JSON in the Manifest with the redirect URL. (Microsoft doesn’t appear to allow the ‘@’ symbol)

“replyUrlsWithType”: [
“url”: “host.exp.exponent://”,
“type”: “InstalledClient”


Thank you! I had been battling this for ages, and it’s working now.

Glad to hear!