Skip to content
This repository has been archived by the owner on Dec 12, 2020. It is now read-only.

Infinite authentication redirect loop. #1

Closed
aliew-interactive opened this issue May 11, 2017 · 2 comments
Closed

Infinite authentication redirect loop. #1

aliew-interactive opened this issue May 11, 2017 · 2 comments

Comments

@aliew-interactive
Copy link

Operating System: Windows 10
Development IDE: Visual Studio 2017 community edition & Visual Studio 2015 community editions.

So I followed all the instructions in deployment.md and preconsent.md for running the app. I also had to update the nuget packages to be compatible with my version of visual studio (Tools->Nuget package manager)

I them tried to run the .sln in my local environment (debug mode) as well as publishing it as a web application to azure. In both cases I was then asked to sign in to my azure account (which I did).
I was than bought to the URL:
https://login.microsoftonline.com/common/oauth2/authorize?client_id=...
where I got caught in an infinite loop of:

  • waiting for localhost
  • waiting for login.microsoft.com
  • waiting for localhost
  • waiting for login.microsoft.com
  • and so on...

I've tried everything I could think of to resolve this error on our end. Including by

  • Redownloading the project, starting over with a new active directory app and reapplying the instructions
  • Different browsers: Chrome/Internet Explorer/Microsoft Edge
  • Changing
    $g = Get-AzureADGroup | ? {$_.DisplayName -eq 'AdminAgents'}
    to
    $g = Get-AzureADGroup -SearchString "adminagents"

In the preconsent.ps1 script, because the former line returned null.

  • Forcing the application to use https instead of http (source/explorer/properties/web) as well as updating the reply urls on the active directory app registrations in azure.
  • Cleaning and rebuilding the project

and I'm out of ideas :(.

When I disabled error suppression on Startup.auth.cs by commenting out line 57:
//context.HandleResponse();
I was greeted with the following error instead:

[DataServiceClientException: {"odata.error":{"code
ng System:_ Windows 10
Development IDE: Visual Studio 2017 community edition & Visual Studio 2015 community editions.

So I followed all the instructions in deployment.md and preconsent.md for running the app. I also had to update the nuget packages.

I them tried to run the .sln in my local environment (debug mode) as well as publishing it as a web application to azure. In both cases I was then asked to sign in to my azure account (which I did).
I was than bought to the URL:
https://login.microsoftonline.com/common/oauth2/authorize?client_id=...
where I got caught in an infinite loop of:

  • waiting for localhost
  • waiting for login.microsoft.com
  • waiting for localhost
  • waiting for login.microsoft.com
  • and so on...

I've tried everything I could think of to resolve this error on our end. Including by

  • Redownloading the project, starting over with a new active directory app and reapplying the instructions
  • Changing

$g = Get-AzureADGroup | ? {$_.DisplayName -eq 'AdminAgents'}
to
$g = Get-AzureADGroup -SearchString "adminagents"
in the preconsent powershell script, because the former line returned null.

  • Forcing the application to use https instead of http (source/explorer/properties/web) as well as updating the reply urls on the active directory app registrations in azure.
  • Cleaning and rebuilding the project

and I'm out of ideas :(.

When I disabled error suppression on Startup.auth.cs by commenting out line 57:
//context.HandleResponse();
I was greeted with the following error instead:

[DataServiceClientException: {"odata.error":{"code":"Authorization_RequestDenied","message":{"lang":"en","value":"Insufficient privileges to complete the operation."}}}]
System.Data.Services.Client.BaseAsyncResult.EndExecute(Object source, String method, IAsyncResult asyncResult) +411
System.Data.Services.Client.QueryResult.EndExecuteQuery(Object source, String method, IAsyncResult asyncResult) +40

Thanks in advance for any fixes.

@ghost ghost self-assigned this May 18, 2017
@alally
Copy link

alally commented Jun 8, 2017

I had this issue. I was missing a permission on the Graph API which was failing when querying information about the user. Adding the correct permissions for the App in Azure AD solved the redirection loop issue for me.

@aliew-interactive
Copy link
Author

aliew-interactive commented Sep 21, 2017

Thanks;
Several months ago I added a number of additional Windows Azure Active Directory permissions that were not in the documentation;
I'm not sure which one resolved the issue; but among them were:

  • Read and write directory data
  • Read and write all groups
  • Read all groups
  • Read all users' full profiles
  • Read all users' basic profiles
  • Sign in and read user profile
  • Read hidden memberships

I do hope the documentation gets updated though

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants