1

I've developed an API with rails-api.

To implement te API authentication I've followed the railscast: http://railscasts.com/episodes/352-securing-an-api.

In the example it uses authenticate_or_request_with_http_token from ActionController::HttpAuthentication::Token::ControllerMethods to check the existence of an authentication token.

What I don't know how to do is sending this token from Angular to the API. Do I have to put it in a header? what header? does it have to be encoded in some way?

1 Answer 1

3

Just found the solution:

  • The token has to be sent like this var authorizationHeader = 'Token token="' + token + '"'
  • That string has to be set in the AUTHORIZATION header.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.