C# External Login -- Unable to set claims

theartha
theartha used Ask the Experts™
on
Hello,

I am using .net, 4.6.1 MVC web application to have the user login into external authentication (Office 365 for now). I am able to sign-in but unable to set the claims and my Request.IsAuthenticated is always false.

Unable to hit this code.
Provider = new MicrosoftAccountAuthenticationProvider
                {
                    OnAuthenticated = async context =>
                    {
..
..
}

Open in new window


Please advice.

Thanks.
AccountController.txt
Startup.txt
Login.txt
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Chinmay PatelChief Technology Ninja
Distinguished Expert 2018

Commented:
Hi theartha,

Do you want to use Outlook or O365 account?

Regards,
Chinmay.

Author

Commented:
Hi Chinmay,

Office 365

Thanks.
Chinmay PatelChief Technology Ninja
Distinguished Expert 2018

Commented:
Hi theartha,

Just to be clear, O365 accounts use Azure AD for authentication, to take advantage of that you should have followed this step when you start, https://docs.microsoft.com/en-us/aspnet/identity/overview/getting-started/developing-aspnet-apps-with-windows-azure-active-directory

Before we go any further, did you configure your project as shown in the guide above?

Regards,
Chinmay.

Author

Commented:
I didn't configure that way. But no matter how I try I was unable to move forward. Since I am in the early stages of the development. I change my path and followed the instructions in these document.

https://docs.microsoft.com/en-us/azure/active-directory/develop/quickstart-v2-aspnet-core-webapp

Thanks for your help.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial