IdentityServer4 icon indicating copy to clipboard operation
IdentityServer4 copied to clipboard

Implicit flow - pass token in query string instead of header

Open ydekova opened this issue 9 years ago • 4 comments

Hi guys, Thanks for the great work you've done on this complex matter.

My question is related to passing the authentication token from a JS client with implicit flow. I have a standard configuration of ID server, API and JS client - all running on different hosts. Mainly because of CORS issues I can't use the Authorization header to pass the token. I need to use URL parameter. I guess this might be quite straight-forward and I did find some examples on what should be done with ID server 3, but I can't figure out how this can be applied to ID server 4.

What should I configure in IdentityServerAuthenticationOptions on API side when registering the middleware with UseIdentityServerAuthentication in order to allow the middleware to get the token from query srting? Or may be this there is a different way this is done?

Thank you for your time!

ydekova avatar Dec 14 '16 18:12 ydekova

There is a func that you can implement to retrieve the token from arbitrary parts of the the http request see here:

https://github.com/IdentityServer/IdentityServer4.AccessTokenValidation/blob/dev/src/IdentityServer4.AccessTokenValidation/IdentityServerAuthenticationOptions.cs#L43

leastprivilege avatar Dec 15 '16 05:12 leastprivilege

Thanks for the quick reply!

In the meanwhile i found this post which might do the trick http://infozone.se/en/authenticate-against-signalr-2/ but your suggestion seems to be the clean way to go.

ydekova avatar Dec 15 '16 08:12 ydekova

New link: https://github.com/IdentityServer/IdentityServer4.AccessTokenValidation/blob/8181a5b4c48b3e5e9318698fbfd110c0e7c01990/src/IdentityServerAuthenticationOptions.cs#L45

farlop avatar Apr 15 '19 09:04 farlop

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

lock[bot] avatar Jan 11 '20 16:01 lock[bot]