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

How to set up headers for a GET or POST authenticated request? #11

Closed
CaptainChemist opened this issue Mar 23, 2015 · 6 comments
Closed

Comments

@CaptainChemist
Copy link

This is more of a question out of ignorance, but if I have a before_action :authenticate_with_token! on this project, can someone tell me how I'd properly set up the headers in sabisu or curl to have GET or POST request that works?

I have tried the header:
Authorization : key

And that doesn't seem to be enough. Thanks so much!

@kurenn
Copy link
Owner

kurenn commented Mar 23, 2015

Let me dig into this, it should work as you have it.

@CaptainChemist
Copy link
Author

Thanks for the reply, you are indeed correct. I am not sure why it wasn't working before, but I can just add that header and it works in sabisu. For curl you can do this:
curl -H "Authorization: rtbyy4Sq6-FuEXMKYzg7" -vv http://api.courseflow.dev/protected/1

@kurenn
Copy link
Owner

kurenn commented Mar 24, 2015

Nice!, I'll be addressing may of this issues on the book as well as on the gem! Thanks!

@tknazn
Copy link

tknazn commented Jul 31, 2015

This is what I use for the POST method.

curl -X POST -i -H "Content-type:application/json" http://localhost:3000/api/sessions -d '
{
"email":"abc@abc.com",
"password":"12345678"
}
'

@kurenn
Copy link
Owner

kurenn commented Aug 3, 2015

@tknazn and are they working correctly?

@tknazn
Copy link

tknazn commented Aug 5, 2015

Yupe - it works and returns with an authorization code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants