Comments (15)
It's weird. In your case in koajs/koa#689, the requests are all belong to the same domain which is 9.xiaojukeji.com
, i think {credentials: 'same-origin'}
is not necessary. Did i miss something?
from isomorphic-fetch.
My call to fetch endeup like this
fetch(url, {credentials: 'same-origin'})
And it worked for me!
from isomorphic-fetch.
@luckydrq yeah. about receiving
not sending
, it's also the scene I came cross.
I found if there is no {credentials: 'same-origin'}
,isomorphic-fetch
would't send browser cookie in get request, and then browser would't save cookies even if the response carried cookies.
then I found jquery ajax
send cookies either receiving
or sending
, and when I add the credentials
it works well. so I guess that's the key.
from isomorphic-fetch.
@darrenchiusw I came across the same scene.
I debug for a long time and it turn out it's the bug of isomorphic-fetch
, which works well when I change to jquery.
from isomorphic-fetch.
isomorphic-fetch
only set the cookie of Response-Cookie, none of the Request-Cookie.
from isomorphic-fetch.
isomorphic-fetch only set the cookie of Response-Cookie, none of the Request-Cookie.
@freestyle21 i still got puzzled. According what you said, isomorphic-fetch
should save cookies set by server successfully. Related issue: koajs/koa#689
from isomorphic-fetch.
@luckydrq when we use isomorphic-fetch
to send an HTTP GET Request
οΌit cannot carry browser cookie to Request Header only if we set option {credentials: 'same-origin'}
here is the document: https://github.com/github/fetch#sending-cookies
from isomorphic-fetch.
yes, i've read that section. But what this issue addresses is how to save cookies to browser, it's about receiving
not sending
, am i right?
from isomorphic-fetch.
maybe isomorphic-fetch
set credentials
by empty or other value default.
and the document has said :
`To automatically send cookies for the current domain, the credentials option must be provided`
https://github.com/github/fetch#sending-cookies
I think this is weird too.
from isomorphic-fetch.
Alright, i'll keep on studying on this. If you find any detail please let me know. Thanks :D
from isomorphic-fetch.
i have a same problem...
from isomorphic-fetch.
Same problem, anyone has a s solution? That should be much appreciated.
from isomorphic-fetch.
My fetch request strangely returned 302 code then I found that it didn't include cookies so not authenticated properly on the server.
{ credentials: 'same-origin' }
works.
from isomorphic-fetch.
Same problem, anyone with a solution? I'd appreciate
from isomorphic-fetch.
Have just solved. Just two f. days of brutforce
For me the secret was in following:
- I called POST /api/auth and see that cookies are successfully received.
- Then calling GET /api/users/ with
credentials: 'include'
and got 401 unauth, because of no cookies were sent with the request.
The KEY is to set credentials: 'include'
for the first /api/auth call too.
from isomorphic-fetch.
Related Issues (20)
- Upgrade node-fetch to >= 2.3.0 to fix semantic-release users that use styled-components HOT 2
- Fix version of whatwg-fetch HOT 1
- eiddccgeilvtdejdrvblujinlecirnvcbbnnnunegklr
- AbortController not working with this library HOT 4
- URLSearchParams in body doesn't set content-type to x-www-form-urlencoded
- Is this library still been maintained? HOT 4
- Tag a new version with the security fix HOT 11
- Add v3.0.0 release notes HOT 2
- How to handle error messages from server - Question HOT 1
- Node.js - realFetch.call is not a function HOT 8
- Isomorphic-fetch Typescript setup HOT 2
- Upgrade node-fetch to version 2.6.1 or 3.0.0-beta.9 HOT 1
- fetch api
- update node-fetch to v3.x HOT 7
- Security risk
- Found a possible security concern HOT 2
- Interceptors
- How to access the referer using isomorphic fetch library? An example would help!
- Dual Form
- Isomorphic fetch returns response with empty stream body HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from isomorphic-fetch.