Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

javascript - Nuxtjs: How to use HttpOnly Cookies for Nuxt-Auth strategy

I worked previously with Vuejs and decided to take a look into NuxtJs. In my previous applications my server sends a HttpOnly cookie which my client couldn't read. So for auth I tried out NuxtAuth which has some startegies and I noticed that it is not possible to use a HttpOnly cookie as strategy. I think this is the limitation of the SSR. But is there a way to use HttpOnly Cookies with NuxtJs? My solution was to run API request only on Client-Side where I have the cookie. This seems to work but I think this is maybe not the ideal solution.

So furthermore how can I setup axios for dev an prod env's in the nuxt.config? When I use the baseURL attribute I got always cors so I tried the proxy which works but the cookies are rejected with the message: The cookie "access_token_cookie" was declined due to invalid domain rights. I thinks this is because the proxy is localhost in dev right? Is there a solution for that?

So any ideas how I can implement HttpOnly authtentication in Nuxt?

question from:https://stackoverflow.com/questions/65642232/nuxtjs-how-to-use-httponly-cookies-for-nuxt-auth-strategy

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...