Redirect from AzureAD not working

Hey there,

im using the tutorial for azure-ad from here:

This is my config:

  adminAuth: {
    type: "strategy",
    strategy: {
      name: "azuread-openidconnect",
      label: "Sign in with Azure",
      icon: "fa-windows",
      strategy: require("passport-azure-ad").OIDCStrategy,
      options: {
        identityMetadata:
          "https://login.microsoftonline.com/MY_TENANT_ID/v2.0/.well-known/openid-configuration",
        clientID: MY_CLIENT_ID,
        clientSecret: MY_SECRET,
        responseType: "code",
        responseMode: "query",
        redirectUrl: "http://localhost:1880/auth/strategy/callback",
        allowHttpForRedirectUrl: true,
        scope: ["email", "profile"],
        verify: function (profile, done) {
          console.log("Profile: " + profile);
          profile.username = profile._json.preferred_username;
          done(null, profile);
        },
      },
    },
    users: function (user) {
      return Promise.resolve({ username: user, permissions: "*" });
    },
  },

But I run into this issue:
AADSTS50011: The redirect URI 'https://localhost:1880/auth/strategy/callback' specified in the request does not match the redirect URIs configured for the application ... Make sure the redirect URI sent in the request matches one added to your application in the Azure portal. Navigate to Error AADSTS50011 the redirect URI does not match the redirect URIs configured for the application - Active Directory | Microsoft Learn to learn more about how to fix this.

Is there something im missing?
I configured the redirect URL in the Azure-App:

Thanks in advance!

In your Node-RED configuration, the callback uri is:

http://localhost:1880/auth/strategy/callback

But in your AD config, you have it set to:

http://localhost:1880

So yes, those two values are different and AD is right to complain.

Update your Azure app's config with the full redirect uri: http://localhost:1880/auth/strategy/callback

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.