Azure Graph API - Multiple web platforms redirect URL not working

Waqar Saleemi 0 Reputation points

I am working with Azure Graph API and it works well when I configure only one web platform having one redirect URL. When I add multiple Web platforms and having multiple redirect URLs, it always redirects back to the last/latest redirect URLs. User's image

As I have multiple urls configured, it should work with different applications hosted.

public void Configuration(IAppBuilder app) {
            var _Configuration = new ConfigurationBuilder().AddJsonFile("appsettings.json").Build();
            var RedirectUri = _Configuration.GetSection("AzureAd:RedirectUri").Value;

            app.UseCookieAuthentication(new CookieAuthenticationOptions());
            OwinTokenAcquirerFactory factory = TokenAcquirerFactory.GetDefaultInstance<OwinTokenAcquirerFactory>();
                .Configure<ConfidentialClientApplicationOptions>(options => { options.RedirectUri = RedirectUri; })
// Sign in

            if (!Request.IsAuthenticated) {
                var context = HttpContext.GetOwinContext();
                context.Response.Headers.Add("Access-Control-Allow-Origin", new[] { "*" });
                    new AuthenticationProperties { RedirectUri = RedirectUri },
Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,011 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. awijekoon 710 Reputation points Microsoft Vendor

    @Waqar Saleemi

    You need to change the redirect URI that you retrieved from appSettings.json.
    var RedirectUri = _Configuration.GetSection("AzureAd:RedirectUri").Value;

    The value of AzureAd:RedirectUri should be changed to the desired redirect URL.

    I Hope this helps. If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.