Azure-Samples / active-directory-dotnet-graphapi-web

A .NET 4.5 MVC web app that demonstrates how to query the Azure AD Graph API using the Azure AD Graph Client Library
82 stars 68 forks source link

Sample does not work on Azure Website it does hovever work perfect locally #59

Open Pelago opened 6 years ago

Pelago commented 6 years ago

When publishing this on Azure webapp and select any menu option needing Authorization I ends up in a never ending logon loop. Everything works perfectly locally.

Am I missing something? Do I need to change anything in the sample to get it to work on Azure?

I did follow the instruction in the sample to connect and publish to Azure but...

jmprieur commented 6 years ago

Would you be using Edge?

Pelago commented 6 years ago

Hi, I usually develop using Firefox for local debug. But I have tested both locally and on Azure with FireFox, Edge, Chrome, Opera and IE to. The same results in all of them. Working Perfect locally. When on Azure I do sign in and my username is visible. If I select any of the menu options for instance Userlist there is a Authentication problem showing the following statement "You have to sign-in to see Users. Click here to sign-in". When selecting the "here" the never ending logon lopp is starting. Same in all Browsers. I Have not for the purpose of this altered any of your used nuget package versions.

jmprieur commented 6 years ago

Thanks for disambiguating, @Pelago Did you add the URL of your deployed application to the Reply URLs in the Azure AD application (in the Azure portal)? Also did you change the PostLogoutRedirectUri in the Web.Config?

Pelago commented 6 years ago

yes i did!

Actually when in the looping logon in Firefox and I hit the go back button, I get this on the screen IDX10301: The 'nonce' found in the jwt token did not match the expected nonce. expected: '636413446339051586.NzFmYTgzZTEtNTM5Ni00NjI3LTk5NWMtZmMyNTdkOGI3MjI5YzJhZjI1YTItZjdjNi00MzQ4LThmZmQtMzliZTk5YWMzMTky' found in jwt: '636413446346708022.ZTliOWFiODQtNzExYS00NTE4LTg2Y2MtNTJhMGVkZWE2MDgyMjUxOGQ3OGItYWZjYS00OWQxLWIxZjYtZjM0M2RmYWU0Mzg1'. + a lot of info of the user i have. and this seems to be the problem..

I have tried to update the application with newer Nuget packages with no luck especially the JWT is causing problems in my mind.. and the code.

Pelago commented 6 years ago

I did do one change in the Web.Config, I added customErrors mode="Off" in the </system.web> section to se the error above

jmprieur commented 6 years ago

@Pelago : for the JWT nuget, can you please try with the previous major version ? (I think I remember that the latest is 4.x, can you try with 3.x) ?

Pelago commented 6 years ago

@jmprieur The same result with JWT Nuget 3.x. There is also a 5.x that do not work eigther.

Pelago commented 6 years ago

Sorry missed that it did not install the Nuget 3.x

Unable to resolve dependencies. 'System.IdentityModel.Tokens.Jwt 3.0.2' is not compatible with 'Microsoft.IdentityModel.Protocol.Extensions 1.0.4.403061554 constraint: System.IdentityModel.Tokens.Jwt (>= 4.0.4.403061554)', 'Microsoft.Owin.Security.OpenIdConnect 3.1.0 constraint: System.IdentityModel.Tokens.Jwt (>= 4.0.0)'. 0

Pelago commented 6 years ago

Same result after altering through all nuget versions of 'Microsoft.IdentityModel.Protocol.Extensions too..

Pelago commented 6 years ago

@jmprieur I hope you did not misstake my misstake above as if everything is working... :)

Pelago commented 6 years ago

@jmprieur do you have any other suggestions to get your sample working on Azure?

subhasisjha commented 5 years ago

I am facing the same issue pelego facing can somebody help me on this

subhasisjha commented 5 years ago

@pelago did you able to fix that issue then please let me know the solution.Or anybody else please help me on this issue