Is there any way to get header referer of request to startRedirectPath?
iamtmoe opened this issue · 4 comments
Prerequisites
- I have written a descriptive issue title
- I have searched existing issues to ensure the issue has not already been raised
Issue
I need to redirect based on referer querystring after handle provider callback
startRedirectPath
need to be added before the server started. So, it should be a static fixed path.
Maybe something like /login/:provider
is possible, you may investigate in it.
@climba03003 Maybe I did't express clear, for example, if i set startRedirectPath to /login/github, and /login?redirect_to=/
is my website login page,there is a button which request /login/github when clicked, after auth the user, I want to redirect to the / based on the querystring, i can't get the initial request referer because the plugin handled the request and I don't know whether it expose the referer data.
generateStateFunction
can intercept the initial request, but you need to find a way to match the initial request and callback
route.
If you manage to use it to achieve what you mention. Remember to return the state inside generateStateFunction
and also pass checkStateFunction
to verify the generated state
.
https://github.com/fastify/fastify-oauth2#set-custom-state
@climba03003 thx, it works, maybe this is another usage scenario of custom state, although it's initial purpose is secure concern
here is a article mention this usage