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.

WebAuthenticator doesn't support Azure App Service callback response.

See original GitHub issue

Description

I would like to use WebAuthenticator when also using Azure App Service Authentication. Unfortunately, EasyAuth does not return the token and expiry in a format that WebAuthenticator understands. To fix this, I propose that we add a “ResponseDecoder” option to WebAuthenticator.

Public API Changes

I’d suggest having a new interface IWebAuthenticatorResponseDecoder:

public interface IWebAuthenticatorResponseDecoder
{
  IDictionary<string, string> DecodeResponseUri(Uri uri);
}

Then, in WebAuthenticator, have a new public property:

public IWebAuthenticatorResponseDecoder? ResponseDecoder { get; set; }

This gets passed as an optional parameter to the constructor of WebAuthenticatorResult (the one that gets passed the Uri). When the response decoder is not null, it is called to convert the Uri into a dictionary (and then everything progresses as normal). When the response decoder is null, the current method (WebUtils.ParseQueryString()) is used to decode the response.

Intended Use-Case

Authenticating to Azure App Service when using Azure App Service Authentication & Authorization.

The generalized method proposed allows customers to parse the callback URL for any platform, and allows App Service to release their own package that has the decoder in it if they desire.

Issue Analytics

  • State:closed
  • Created 10 months ago
  • Reactions:2
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
adrianhallcommented, Nov 28, 2022

An example of an App Service response:

https://web-adhal-test.azurewebsites.net/.auth/login/done#token=%7B%22authenticationToken%22%3A%22eyJhbGXXXXXzI1NiIsInR5cCI6IkpXVCJ9.eyJzdGFibGVfc2lkIjoic2lkOjc2YmFlYTg0N2U5ZDdiYzIxMTVkYmEyMTQxNDcwNWUwIiwic3ViIjoic2lkOjVkMWU3YTM5Y2I1NjY1ODhjNGNlYjAxNmVkOTQ0ZDUyIiwiaWRwIjoiYWFkIiwidmVyIjoiMyIsIm5iZiI6MTY2OTY1NDc5NiwiZXhwIjoxNjY5NjU5MjU5LCJpYXQiOjE2Njk2NTQ3OTYsImlzcyI6Imh0dHBzOi8vd2ViLWFkaGFsLXRlc3QuYXp1cmV3ZWJzaXRlcy5uZXQvIiwiYXVkIjoiaHR0cHM6Ly93ZWItYWRoYWwtdGVzdC5henVyZXdlYnNpdGVzLm5ldC8ifQ.D40VnD2QwUutI0mSNoSV1ccVI1jy85xCBMZSibrjDPU%22%2C%22user%22%3A%7B%22userId%22%3A%22sid%3A5d1e7a39cb56658XXXXXX16ed944d52%22%7D%7D

I’ve replaced some critical letters in the auth token a userId SID for security.

0reactions
JayWilkcommented, Jan 31, 2023

Yep can totally replicate this.

I set up a server side authenticator following the tutorial on Microsoft Learn: https://learn.microsoft.com/en-us/dotnet/maui/platform-integration/communication/authentication?view=net-maui-7.0&tabs=android

When my WebAuthenticator calls my endpoint, via WebAuthenticator.Default.AuthenticateAsync, the API endpoint processes the Auth request then when returning back to the MAUI app - nothing… the MAUI app just freezes and a response is never captured when debugging…

Anyone know a workaround?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Authentication and authorization - Azure App Service
Find out about the built-in authentication and authorization support in Azure App Service and Azure Functions, and how it can help secure ...
Read more >
Azure App Service secured by AAD Angular callback
I have an Azure App Service with an Angular App as Docker container. Everything works fine. Now I want to add a security...
Read more >
Net MAUI WebAuthenticator CallbackUrl for social logins
I've tried following this guide and have 'registered' my app in azure active directory but facebook/google etc won't accept urls of the form...
Read more >
Add Authentication to .NET MAUI Apps with Auth0
Learn how to authenticate users of your .NET MAUI application using OpenID Connect and Auth0.
Read more >
Connect Your App to Microsoft Azure Active Directory
Select a Redirect URI type of Web, and enter your callback URL: https://{yourDomain}/login/callback . Find your Auth0 domain name for redirects. If your...
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