Sign Up
Go Pro Sign Up Login

Buy Now and unlock this series

$

49

.99

$

29

.99

yours forever

Become a Pro and unlock everything

$

24

.99

per month

Implementing CORS

Now that we know what CORS is, let's implement it in our project. npm install --save fastify-cors

Downloads

Become a pro to download code and videos

Comments

Mark Volkmann

5 months ago

I found the cause of the cookies not being send to my logout service. I'm sending a GET request instead of a POST since no body data is needed. But I forgot to pass the credentials: 'include' option to the fetch function. After adding that, the cookies are being passed.

User avatar

Sepp Wikramaratna-Clarke

5 months ago

Mark Volkmann

5 months ago

After making all the changes up to this point, my API service for logging out no longer receives any cookies. Since I don't get the refresh-token, I can't find the session and delete it. I do see the access-token and refresh-token in the browser DevTools. The both have the domain ".nodeauth.dev". Note the period at the beginning. Is that the expected domain value? Should it be "api.nodeauth.dev" instead? Do I need to change the value of ROOT_DOMAIN in my .env file from "nodeauth.dev" to "api.nodeauth.dev"?

Want to join the conversation?

Become a Pro member today!