question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Bug] Azure changes redirect_uri from http to https causing TcpInterceptor to fail in parsing the response

See original GitHub issue

Which Version of MSAL are you using ? 4.1

Platform netcore

What authentication flow has the issue?

  • Desktop / Mobile
    • Interactive
    • Integrated Windows Auth
    • Username Password
    • Device code flow (browserless)
  • Web App
    • Authorization code
    • OBO
  • Web API
    • OBO

Other? - please describe;

Is this a new or existing app? New app

Repro

var clientId = "<CLIENT-ID>";
var authority = "https://login.windows.net/<TENANT-ID>";
var scopes = new[] { "https://vault.azure.net/.default" };
IPublicClientApplication app = PublicClientApplicationBuilder.Create(clientId)
                .WithAuthority(new Uri(authority), true)
                .WithRedirectUri("http://localhost:4001")
                .Build();

var result = app.AcquireTokenInteractive(scopes).ExecuteAsync().GetAwaiter().GetResult();

Expected behavior A token should be received

Actual behavior An exception is triggered Microsoft.Identity.Client.MsalClientException: ‘Could not extract the query from the authorization response - check Pii enabled logs for details’

Possible Solution After debugging this a bit, it turns out that while MSAL is sending the correct request to Azure (redirect_uri=http://localhost:4001), Azure then redirects to httpS://localhost:4001, which causes the TcpInterceptor to fail because it receives an ssl handshake request instead of a http request.

This might be a bug on the Azure side (why is it changing http to https?), but since this is the library which is exposing the bug I’m reporting it here.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
bgavrilMScommented, Jul 16, 2019

Thanks for following up!

0reactions
jmprieurcommented, Jul 16, 2019

@bgavrilMS : do you think we should document this behavior?

Read more comments on GitHub >

github_iconTop Results From Across the Web

The claims exchange returned HTTP error response that ...
I'm new to API Connectors of Azure, Azure user creation like ... except Azure API Connector cannot parse the HTTP Content OK response....
Read more >
Can't access this Corporate Application error with Azure ...
This article helps you troubleshoot common issues for the "This corporate app can't be accessed" error on an Azure AD Application Proxy ...
Read more >
Solved: Error while parsing JSON: 'Unexpected character en...
Solved: Hi there, I have a flow created that uses SQL connector to connect to a database view and pulls records from there...
Read more >
Error parsing app package
I keep getting : Error in parsing the app package. First off let me say I can access both the .appinstaller file and...
Read more >
Azure API Manager OpenApiSpecification parser claims ...
I have an OpenAPI hooked up to my Azure API manager. I have a valid OpenAPI json file that was generated by my...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found