Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cookie not found support #443

Closed
BruceWayneVsSuperMan opened this issue Dec 19, 2019 · 18 comments
Closed

cookie not found support #443

BruceWayneVsSuperMan opened this issue Dec 19, 2019 · 18 comments
Labels
discussion Talking over coding feature New feature or request need information Requires more info

Comments

@BruceWayneVsSuperMan
Copy link

Our server responsed cookie not found error.
But actually,with the same param postman worked.
I wonder know if I need to add some extra param when I use postwoman.

@liyasthomas
Copy link
Member

liyasthomas commented Dec 19, 2019

Under normal conditions, params are sent as (async/await XHR) HTTP requests. If there's any specific criteria for your server, you've to append that information either in params or headers as server request.

Share endpoint to debug

@BruceWayneVsSuperMan
Copy link
Author

Thanks for your reply.
I understand your meaning. But the thing I do want to know is how to make it work like postman.
Means that I don't need to add cookie or login info.
I want to use postwoman replace postman.Because I think it looks beautiful and I can use it in explore.

@liyasthomas
Copy link
Member

Let me look into the issue and get back to you after a while. I think there's an option to use cookies with withCredentials: true

@liyasthomas liyasthomas added feature New feature or request need information Requires more info labels Dec 19, 2019
@BruceWayneVsSuperMan
Copy link
Author

All right, waiting for your good news.

@liyasthomas
Copy link
Member

Nuxt Axios module currently support credentials option only work when axios request to baseURL or relative path.

This is in the specification, not a bug.

nuxt-community/axios-module#168 (comment)

@NBTX
Copy link
Contributor

NBTX commented Dec 22, 2019

I'm reading that we can just set withCredentials: true to the .$post options...

@NBTX NBTX added the discussion Talking over coding label Dec 22, 2019
@NBTX NBTX reopened this Dec 22, 2019
@liyasthomas
Copy link
Member

But isn't that only supposed to be working on requests sent to same origin?

@BruceWayneVsSuperMan
Copy link
Author

I just found something that may help us.
Please see this pic.
I am wondering if the secret is the postman-token param.

@BruceWayneVsSuperMan
Copy link
Author

If you can't see this pic, leave me a message.Cause I was limited on internet,and I can't see if it's uploaded.

@liyasthomas
Copy link
Member

Can't see the image.

@BruceWayneVsSuperMan
Copy link
Author

Very appreciate for your patience and help.
I sent it to your email.Please check it out.

@liyasthomas
Copy link
Member

liyasthomas commented Dec 23, 2019

Got the mail. It seems like, a cookie is sent as a custom header along with the request.

In PW, you can add custom Headers too. In Options section, navigate to Headers tab to add custom headers.

1223_1

But I wonder how you generated this custom header postman-token's value? I suppose you took Cookie from Environment variables.

Here's a screenshot of how I added a custom header and generated cURL code snippet with PW.

Screenshot_20191223-072254

If you've limited internet access, no need to download the image, this is the generated cURL:

curl -X GET \
  'https://reqres.in/api/users' \
  -H 'cache-control: no-cache' \
  -H 'postwoman-token: this_can_whatever_you_want' \
  -H 'content-type: application/json'

And here's your public Sharable link with above configuration: https://postwoman.io/?method=GET&url=https%3A%2F%2Freqres.in&path=%2Fapi%2Fusers&headers=%5B%7B%22key%22%3A%22cache-control%22,%22value%22%3A%22no-cache%22%7D,%7B%22key%22%3A%22postwoman-token%22,%22value%22%3A%22this_can_whatever_you_want%22%7D,%7B%22key%22%3A%22content-type%22,%22value%22%3A%22application%2Fjson%22%7D%5D&rawParams=%7B%7D

Open this link to preload configs

@BruceWayneVsSuperMan
Copy link
Author

Emmm…… actually,I didn't add the postman-token. Everytime when I try to request, postman will generate a new postman-token.
I read an article about it, this is the answer.

This is primarily used to bypass a bug in Chrome. If an XMLHttpRequest is pending and another request is sent with the same parameters then Chrome returns the same response for both of them. Sending a random token avoids this issue. This can also help you distinguish between request on the server side.

@liyasthomas
Copy link
Member

liyasthomas commented Dec 23, 2019

Thanks! Will look into it

Sooner or later, we're gonna have to implement this 😊

@BruceWayneVsSuperMan
Copy link
Author

I think so.It will be better with your development.
Actually I received a lot of email last weekend cause I followed and watched this project, you were solving problems anytime,anywhere...

@liyasthomas
Copy link
Member

liyasthomas commented Dec 23, 2019

Just shipped API documentation feature 😄

@jackflyer
Copy link

Is there any option to set withCredentials from front side? or guide on where to set that option.

@liyasthomas
Copy link
Member

liyasthomas commented Mar 24, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Talking over coding feature New feature or request need information Requires more info
Projects
None yet
Development

No branches or pull requests

4 participants