asp.net mvc - MVC OpenId Microsoft Idenity GetExternalLoginInfoAsync null -


i trying implement microsoft identity in existing azure cloud service. cloud service consists of asp.net mvc 5 web role. using useopenidconnectauthentication middleware.

the application succesfully redirects user microsoft signin page. after application prompts application's login page, , user not logged in. when check externallogincallback function in accountcontroller, value of authenticationmanager.getexternallogininfoasync() returns null. code in startup.auth.cs is:

public void configureauth(iappbuilder app) {     app.createperowincontext(applicationdbcontext.create);     app.createperowincontext<applicationusermanager>(applicationusermanager.create);     app.createperowincontext<applicationsigninmanager>(applicationsigninmanager.create);      app.usecookieauthentication(new cookieauthenticationoptions     {         authenticationtype = defaultauthenticationtypes.applicationcookie,         loginpath = new pathstring("/account/login"),         provider = new cookieauthenticationprovider         {             onvalidateidentity = securitystampvalidator.onvalidateidentity<applicationusermanager, applicationuser>(                 validateinterval: timespan.fromminutes(30),                 regenerateidentity: (manager, user) => user.generateuseridentityasync(manager))         }     });     app.useexternalsignincookie(defaultauthenticationtypes.externalcookie);     app.useopenidconnectauthentication(new openidconnectauthenticationoptions     {         authority = "https://login.microsoft.com/common/v2.0",         clientid = "-----client id here------",         scope = "openid email",         redirecturi = "https://localhost",         tokenvalidationparameters = new tokenvalidationparameters         {             validateissuer = false         }     }     ); } 

i checked if token available in onauthorizationcodereceived event, , was. notification.jwtsecuritytoken contained requested information.

does have clue why getexternallogininfoasync() returning null value, while token received application?

if understood correctly, using openid connect owin component integrate app azure ad v2.0 endpoint.

here steps tested , worked me reference:

1 . register web app app new portal

2 . create mvc application using visual studio

3 . install openid connect owin component
install-package microsoft.owin.security.openidconnect

4 . modify startup class use openid connect

app.useopenidconnectauthentication(new openidconnectauthenticationoptions {     authority = "https://login.microsoft.com/common/v2.0",     clientid = "",     clientsecret= "",     scope = "openid email",     redirecturi = "http://localhost:1317/",     tokenvalidationparameters = new tokenvalidationparameters         {             validateissuer = false         }     }  ); 

the difference between code register web app. there clientsecret parameter in code.


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -