Ade
Ade

Reputation: 631

Azure App Service custom authentication getting System.ArgumentNullException: "Value cannot be null" "Parameter name: provider"

I have a simple dot net mobile app with custom authentication following the example at (https://learn.microsoft.com/en-us/azure/app-service-mobile/app-service-mobile-dotnet-backend-how-to-use-server-sdk#custom-auth)

I have an endpoint for generating the JWT Token https://test2ixresearcher.azurewebsites.net/.auth/login/custom?username=ade%40ixcompany.com&password=a (the user name and password are not checked, you can enter anything)

This creates a token which I use to call a secured endpoint with the provided token in the X-ZUMO-AUTH header: https://test2ixresearcher.azurewebsites.net/api/SecuredData - Calling the end point with an incorrect token or token missing returns a 401, as expected - Calling the end point with the token just created generates a 500 with the following message, no expected

--Start Error message-- Application: 2018-09-22T23:12:20 PID[5520] Critical System.ArgumentNullException: Value cannot be null. Application: Parameter name: provider Application: at Microsoft.Azure.AppService.Authentication.EasyAuthTokenStore.d__7.MoveNext() Application: --- End of stack trace from previous location where exception was thrown ---

--End Error message-- I also have an unsecured endpoint and this works without any problems. https://test2ixresearcher.azurewebsites.net/api/UnSecuredData

I have deployed at least 4 other apps with this model and this is the first instance of having this error. The error appears in the authentication, it seems to successfully validate the token issuer and pull out the user, and it fails before hitting my code.

My code can be found at https://github.com/antitheos/publictesting/tree/master/TestAzureCustomLogin

This is happening when published to azure in a new app service created through the portal or Visual Studio. I have old app services working but I afraid to trying publishing to them in case i break live apps the are working.

Any help would be appreciated.

Upvotes: 4

Views: 2066

Answers (1)

razaross444
razaross444

Reputation: 533

Ok, Microsoft found the issue!

The product team found a regression bug and it's now slated for fixing in the next release for about a month from now. In the meantime, you can resolve it with the following steps.

  1. Open Azure portal, navigate to your App Service
  2. Click on Resource Explorer blade
  3. Under your site node, expand the config node and then click authSettings.
  4. In the top pane, ensure you have read/write selected.
  5. Click Edit button
  6. Modify the runtimeVersion to = 0.0.0
  7. Click Put
  8. Click Post
  9. Restart your website.

enter image description here

Upvotes: 4

Related Questions