C# External Login -- Unable to set claims

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
thearthaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Chinmay PatelChief Technology NinjaCommented:
Hi theartha,

Do you want to use Outlook or O365 account?

Regards,
Chinmay.
thearthaAuthor Commented:
Hi Chinmay,

Office 365

Thanks.
Chinmay PatelChief Technology NinjaCommented:
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.
thearthaAuthor 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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.