Replies: 7 comments
-
I noticed there is the |
Beta Was this translation helpful? Give feedback.
-
Hi - yes, the correct way to get the user is via the X-Forwarded-User header, the way I do this in my own Vue.js SPA's is to write that value into a global javascript variable on page load. What are you using for the http server? You can also extract the value from the cookie, but this is not a reliable API and the format is liable to change between versions. |
Beta Was this translation helpful? Give feedback.
-
I'm serving my files with an nginx server. |
Beta Was this translation helpful? Give feedback.
-
@thomseddon would you have time to shortly explain how you do it? Many thanks. |
Beta Was this translation helpful? Give feedback.
-
Hmm, I tend to deploy my apps with their own server - go, node.js or php, so I use the app server to insert the header variable into the page. If you're serving directly from nginx, then a possible workaround could be to use the ngx_http_sub_module module to insert the header value into the page, but this probably isn't ideal, so the lightweight app server would be a more portable way to go. |
Beta Was this translation helpful? Give feedback.
-
Moving to discussion |
Beta Was this translation helpful? Give feedback.
-
You can enable http header reading using |
Beta Was this translation helpful? Give feedback.
-
I have my frontend application running in Vuejs with kubernetes and traefik 2.
I managed to make the traefik-forward-auth works fine, meaning I see the Google login screen and I am then redirected to my application in Overlay Mode.
However once I'm back on my frontend application (vuejs) how do I retrieve logged in user?
I did add the
authResponseHeaders = ["X-Forwarded-User"]
to my middleware but I can't read headers of the current request in javascript right? That would work if my front facing application would be in PHP for example I guess.So in this case, how do I get the current user email address?
Beta Was this translation helpful? Give feedback.
All reactions