-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Logout doesn't redirect back to my app #127
Comments
I'm unable to reproduce this. Can you provide a Fiddler trace of the network when you are having this issue? |
I've never used fiddler and I tried to export the data in several formats, none seemed to have enough info. Just "saving" the trace warns that it might contain unencrypted passwords. But I made sure to include only the logout trace, so I think that's fine. |
@khalibloo We do not see any logout requests in your fiddler. To do this, just open fiddler, click login, enter your credentials and then clear the traces. This will make sure you do not have any credentials in your trace when you send it to us. Now click logout and then you should see the following get request sent out from msal. GET /rohit1.onmicrosoft.com/oauth2/logout?post_logout_redirect_uri=https%3A%2F%2Flocalhost%3A44326%2F HTTP/1.1. Please resend the fiddler when you get a chance. |
Hi,
The console spills errors. |
@khalibloo did you try setting reply uri in portal? (See below) I have the same issue. I end up with the following sequence of URLs:
Google lead me to this MSDN page which stated **This value [post_logout_redirect_uri] must match one of the redirect URIs registered for the application. ** I then added that to the portal, triple checking application id, etc. It still did not work. |
If you have post_logout_redirect_uri parameter defined, then it should redirect you back your app. It works fine for me |
I initialize my
I just tested again. The log out screen is different from last time, but issue still remains. |
This is my logout method: |
And redirectUri is not "post_logout_redirect_uri" |
Oh you manually rewired the logout call. I just used |
That's strange. You are supposed to be redirected back after getting "You signed out of your account". Can you inspect that page? I mean the page where is says " You signed out of your account". Also I don't know why you have two Redirect Urls in your app portal. Your post_logout_redirect_uri must be the same as the redirect url you set in the Application Registration Portal. May be there is a conflict because you have two urls in there. But you can inspect the sign out page in chrome or use fiddler to monitor the traffic. Inspect using chrome first and let's see if there is an error. |
When inspecting the "You signed out of your account" page, the console is empty, indicating no errors. The network tab shows that all requests were completed with a 200 status code. I will look into the multiple redirect Urls in my portal, but I doubt that will change anything. It is after all reasonable for an app to have multiple redirect Urls. |
Yea multiple redirect urls will not be an issue. I just tested that and it still worked. I think It is safe to say there is something else causing that...fiddler might give you a better visibility tho. From the image you have above, you will need to configure it to decrypt https...then try sign out |
Ok, I'll look that up and let you know how it goes. Thanks a lot for taking the time. |
After several tries, I discovered setting Fiddler to decrypt HTTPS breaks msal's connection to the microsoft servers. The sign in and sign out processes stop working all together. The sign in popup disappears after a second or less. The sign out redirect ends in a browser error page "Unable to create secure connection". I'm guessing it sees fiddler as a malicious sniffer of sorts. |
Fiddler is not supposed to interfere with the app. And if you close Fiddler, does it work? If only I can see your code. As for me, I'm using angular, here is what I have done with it: http://www.sharepointcorridor.com/2018/03/calling-microsoft-graph-api.html Though I didn't implement logout in the post but I later did it as explained above, and it works fine. |
Yes, when I close Fiddler, it works. Or when I press F12 to stop capturing on Fiddler, that works too.
There really isn't anything that seems out of place in the sign out function. It's just a simple call to |
@khalibloo This does not seem to be an issue with the library. The library correctly creates the logout request to send to the authorization endpoint. Closing this issue as this is out of scope. |
Hey! Is there a way to do a silent logout? |
I also experienced this issue: the post logout redirect isn't respected after calling logout in a React-based app. From what I've read elsewhere this could be some kind of timing issue... |
Guys . anyone got this working? BTW, Why this issue is in closed state? |
@yesoreyeram The logout page not redirecting back to your app for MSA accounts is a known issue with the logout page (and the team that owns the logout page is aware). There isn't anything the library can do to fix this, which is why this issue is closed. |
@jasonnutter thanks for confirming. Is there any authentic url to track this issue? |
@yesoreyeram Nothing external from MSFT, unfortunately. |
You have to redirect the page to login one. That's the only one solution.
Get Outlook for Android<https://aka.ms/ghei36>
…________________________________
From: Jason Nutter <[email protected]>
Sent: Wednesday, December 18, 2019 11:59:32 PM
To: AzureAD/microsoft-authentication-library-for-js <[email protected]>
Cc: Chinmay Sawant <[email protected]>; Comment <[email protected]>
Subject: Re: [AzureAD/microsoft-authentication-library-for-js] Logout doesn't redirect back to my app (#127)
@yesoreyeram<https://github.com/yesoreyeram> Nothing external from MSFT, unfortunately.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#127?email_source=notifications&email_token=AEL4JOVYG7DSUBVYNNFYT3LQZJTYZA5CNFSM4D23UQJ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHHBKCQ#issuecomment-567153930>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AEL4JOVBZXFMED6SX7FPB3DQZJTYZANCNFSM4D23UQJQ>.
|
Hi @jasonnutter , is there news regarding this issue ? Could you please describe more specifically in what circumstances the redirect is working or not working as of april 2020 ? we are hitting the same problem after redirecting to Thanks in advance for your time |
@jonenst For MSA accounts, the logout page should redirect back to your app if:
I just tested this with my personal MSA account and our React sample app and it worked. |
hi @jasonnutter , thanks for taking the time to answer. I still can't the redirect to work :( Below is my setup, did I misunderstand one of your instructions ? Thanks in advance Here's what I have: |
Ok, just got it to work, using a personal account and the /common tenantid and v2.0 . Do you know the exact restrictions ...? Thanks in advance. |
Great, so sounds like you need to use |
Hi guys! I still can't get it to redirect back to my site. At OpenIdConnectAuthenticationOptions, I have the below option: And I have these two at Redirect URIs: After log out it's still stuck at https://login.microsoftonline.com/common/oauth2/v2.0/logoutsession What do I have wrong Jon? :) |
In my case I needed a logout url different than the root. I used /logout.
Le dim. 12 avr. 2020 à 13:14, suencien <[email protected]> a écrit :
… Hi guys! I still can't get it to redirect back to my site.
At OpenIdConnectAuthenticationOptions, I have the below option:
Authority = "https://login.microsoftonline.com/common/v2.0",
RedirectUri = "https://iluvrun.com/signin-oidc",
PostLogoutRedirectUri = "https://iluvrun.com"
And I have these two at Redirect URIs:
https://iluvrun.com/signin-oidc
https://iluvrun.com
After log out it's still stuck at
https://login.microsoftonline.com/common/oauth2/v2.0/logoutsession
What do I have wrong Jon? :)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#127 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAVY6B4BSOGNX2Y66HQIGLRMGPBPANCNFSM4D23UQJQ>
.
|
Hmm.. does you logout page performs logout function? |
My /logout page doesn't do anything but redirect to /
It works only with a personal account
In addition to beeing declared as a reply URL, my /logout page is also the
sso logout url.
Le dim. 12 avr. 2020 à 17:36, suencien <[email protected]> a écrit :
… Hmm.. does you logout page performs logout function?
The user has actually been logged out before going to the Microsoft page.
I tried forwarding it to another page but it doesn't work either.
If possible I like the user to be just directed to the home page instead.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#127 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAVY6HSRC2LYHQXVBBE7NLRMHNWPANCNFSM4D23UQJQ>
.
|
Hey I got mine working!
For me adding these two lines just logs the user out without having to go to the Microsoft log out page.
Request.GetOwinContext().Authentication.SignOut(Microsoft.AspNet.Identity.DefaultAuthenticationTypes.ApplicationCookie);
Request.GetOwinContext().Authentication.SignOut(Microsoft.Owin.Security.Cookies.CookieAuthenticationDefaults.AuthenticationType);
From: Jon Harper <[email protected]>
Sent: Sunday, 12 April 2020 11:29 PM
To: AzureAD/microsoft-authentication-library-for-js <[email protected]>
Cc: suencien <[email protected]>; Comment <[email protected]>
Subject: Re: [AzureAD/microsoft-authentication-library-for-js] Logout doesn't redirect back to my app (#127)
My /logout page doesn't do anything but redirect to /
It works only with a personal account
In addition to beeing declared as a reply URL, my /logout page is also the
sso logout url.
Le dim. 12 avr. 2020 à 17:36, suencien <[email protected]<mailto:[email protected]>> a écrit :
Hmm.. does you logout page performs logout function?
The user has actually been logged out before going to the Microsoft page.
I tried forwarding it to another page but it doesn't work either.
If possible I like the user to be just directed to the home page instead.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#127 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAVY6HSRC2LYHQXVBBE7NLRMHNWPANCNFSM4D23UQJQ>
.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub<#127 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AKTGPGM5M3DABC4WJNTJTSLRMHT6NANCNFSM4D23UQJQ>.
|
Any idea or reason on why this is working only with personal accounts? I understand this is probably not an issue with the library, but I couldn't find a better place to ask and this one seems to be the more up-to-date discussion about the topic. Thank you very much. |
@Riff451 Redirecting back to the logout URL works with both personal and organizational accounts (see my guidance above, which also applies for organizational accounts). |
@jasonnutter Hi, thanks for the reply. I probably should've mentioned that I'm using a B2C tenant even if I'm trying the standard Azure AD identity feature.
It works with all these values for the authority (with both personal and organizational accounts)
But if I try to use my tenantId or name ( I'm using my external aad organizational account in this scenario. The one automatically added as global admin during the B2C tenant creation. Hope this is clear enough :) Thanks again! |
@Riff451 Can you please open a new issue, thanks! |
On calling logout(), I expect the browser to be redirected to my app once the logout process is completed. However, I just get a screen "You signed out of your account ..." and it stays there.
I think it's intrusive that the user is redirected away from my app in the first place. Why not have a pop up at the very most instead? It's tempting to just clear my local storage variables and skip the logout process entirely.
I should also mention that I'm testing with a localhost address and yes that address is included in my app's registration on the portal.
The text was updated successfully, but these errors were encountered: