-
Notifications
You must be signed in to change notification settings - Fork 1k
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
OpenId Authentication callback/event after login #479
Comments
@mesteves, You can subscribe to OnTokenValidated event in AddMicrosoftIdentityWebApp as shown in this link: Using delegate events. |
How can you do this with AddMicrosoftIdentityWebAppAuthentication? |
There are two ways:
|
Thank you for the reply. In the OnTokenValidated event I want to do some custom permission checks and if they don't pass then I want to redirect to a nice error screen. How can I do this? I tried to do: arg.HttpContext.Response.Redirect("/somepage"); but it didn't work. I see in the example it throws an UnauthorizedAccessException but how can I show a nice descriptive error page ? if i throw that exception than the URL goes to /MicrosoftIdentity/Account/Error and I found this page to scafford but I don't see the option for /MicrosoftIdentity/Account/Error or even /Account/Error ..? |
also - how can I easily query ms graph in OnTokenReceived to get additional info about the user? note I added new issue: #482 thank you |
@dbman86 : maybe "somepage" has the [Authorize] attribute? you'd want to remove it for the error message page ... |
@jmprieur thanks for reply but no it has [AllowAnonymous] . other ideas? |
Please let us know if this issue is still relevant after all the updates the samples have gone through. Or, we'd go ahead and close this issue |
This issue is for a: (mark with an
x
)The issue was found for the following scenario:
Please add an 'x' for the scenario(s) where you found an issue
Repro-ing the issue
Repro steps
Expected behavior
I would expect an event to be exposed, to when the user performs authentication, using the AD login page, and when he returns to the application. This because I need to perform some actions right after a successful login.
Actual behavior
No event discovered :( , I've read several articles and MSFT documentation and found nothing. Is there a way yo do it ?
Possible Solution
??
Additional context/ Error codes / Screenshots
Any log messages given by the failure
Add any other context about the problem here, such as logs.
OS and Version?
Versions
ASP.NET Core 5
Attempting to troubleshooting yourself:
Mention any other details that might be useful
The text was updated successfully, but these errors were encountered: