JwtSecurityToken working on mywebapp.azurewebsites.net but not with my custom domain

David Richards 1 Reputation point
2023-02-27T17:27:45.7+00:00

My azure web app is still in development.

I am using a JwtSecurityToken for authentication.

Everything works fine for mywebapp.azurewebsites.net url.

The JWTSecurityToken signingkey is obtained from the WEBSITE_AUTH_SIGNING_KEY environment variable.

The WEBSITE_HOSTNAME environment variable is mywebapp.azurewebsites.net

I set the audience and issuer to https://mywebapp.azurewebsites.net.

I also have two claims, 1-UserId and 2-userRole

I am able to browse to https://www.mycustomdomain.com with no problems.

When I try to login with a username and password I am still getting WEBSITE_HOSTNAME as mywebapp.azurewebsites.net and not www.mycustomdomain.com

I have tried to set audience and issuer to www.mycustomdomain.com with no success.

Do I need to be in Azure production for this work properly or do I need to make additional settings in Azure.

Any suggestions would be welcomed!

Dave

Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,790 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Grmacjon-MSFT 15,361 Reputation points
    2023-03-03T17:51:08.8766667+00:00

    Hi @David Richards

    if I understand correctly it seems like you are trying to use a custom domain for your Azure web app and you are facing issues with the JWT security token? how did you set your audience and issuer to your custom domain?

    No you don''t need to be in production for it to work. you need to make sure that the custom domain is properly configured in Azure. You can follow the steps in the tutorial "Tutorial: Register a web application in Azure Active Directory B2C" to learn how to register a web application in Azure Active Directory B2C using the Azure portal.

    hope that helps.

    0 comments No comments