sotsera / sotsera.blazor.oidc

OpenID Connect client for Blazor client-side projects
https://blazor-oidc.sotsera.com/
Apache License 2.0
20 stars 8 forks source link

Redirect to page user came from #13

Open hutchcodes opened 4 years ago

hutchcodes commented 4 years ago

Is it possible to have the user returned to the page they left when they started the login process?

  1. User is on myapp.com/foo
  2. User clicks login and goes through the login process at the IDP
  3. User is returned to myapp.com/oidc/callbacks/authentication-redirect
  4. User is redirected to myapp.com (I'd expect myapp.com/foo)
ghidello commented 4 years ago

Very good point! For now I think that the easiest way for achieving this would be to use the popup interaction so that the route in the main application will not change. In order to save the path and go back to it after a redirection I'll have to setup some hooks for configuring the oidc state setting the path and for using it after the redirection. I'll work on it.

ghidello commented 4 years ago

I just pushed a new version of the library that contains some hooks on the login and logout methods and some configuration options for enabling the "redirect to caller" page. You can see them in action in the example site: https://github.com/sotsera/sotsera.blazor.oidc/blob/53d50616cbd22e723245150631d9e1b2640049b0/samples/ClientSide/Startup.cs#L18-L19

Let me know if you'll have a chance to test it out