davidjrh / dnn.azureadprovider

The DNN Azure Active Directory Provider is an Authentication provider for DNN Platform (formerly DotNetNuke) that uses Azure Active Directory OAuth2 authentication to authenticate users.
MIT License
35 stars 22 forks source link

Strange Exception Error DNN9 #3

Closed jgrahamfcac closed 11 months ago

jgrahamfcac commented 7 years ago

Hi, I followed the instructions and have even recreated the DNN instance. Once I sucessfully authenticate with Azure, I get this error which I can access from the admin logs. Any ideas?

Default.aspx DefaultDataProvider:DotNetNuke.Data.SqlDataProvider, DotNetNuke ExceptionGUID: AssemblyVersion:9.1.0 PortalId:0 UserId:-1 TabId:41 RawUrl:/myfcac/Login?code=AQinserthugecode Referrer:http://my.xxx.xxx/xxx/Login?returnurl=%2fxxx%2f UserAgent:Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.79 Safari/537.36 Edge/14.14393 ExceptionHash:2EkBxCkXPumUyBpTHS6NoTboxPU= Message:Object reference not set to an instance of an object. StackTrace: InnerMessage:Object reference not set to an instance of an object. InnerStackTrace: at DotNetNuke.Authentication.Azure.Components.AzureClient.GetCurrentUser[TUserData]() at DotNetNuke.Authentication.Azure.Login.GetCurrentUser() at DotNetNuke.Services.Authentication.OAuth.OAuthLoginBase.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

iiminov commented 7 years ago

@jgrahamfcac I think I had a similar issue with one of our users. It boiled down to incorrect or missing (Azure) profile entry.

Id, Email, FirstName, LastName, DisplayName are the five properties the provider is trying to extract from the claim. If one of those is missing claims.FirstOrDefault(x => x.type == {type}).Value throws object reference exception which is what you're getting.

Have the user check their profile and make sure they specify First and Last names.

Hope this helps.