class API::V1::SessionsController

Public Instance Methods

create() click to toggle source

Authorize the user and returns a new authorization token. By default returns just a token as a text string, but it could be modified by adding .xml or .json extensions. The token can be stored in the local system, it contains User password encrypted by the key stored on the Tarkin server.

GET|POST /_api/v1/_authorize[.xml|.json]

  • User email and password

  • basic http authentication in header


resp = conn.get("http://localhost:3000/_api/v1/_authorize", email: "", password="password0")
token = resp.body if resp.status == 200
#=> "vwbtYjEtZl4IY31HBfJbXD31EUdTLv4stnzVQG8AiiZDagQ3s2IIKcRp..."


via get

OS_TOKEN=`curl "http://localhost:3000/_api/v1/_authorize?"`

via http authentication

OS_TOKEN=`curl --user "http://localhost:3000/_api/v1/_authorize"`

# File app/controllers/api/v1/sessions_controller.rb, line 20
def create
  respond_to do |format|
    format.json { render json: {token: @token} }
    format.xml  { render xml:  {token: @token} }
    format.text { render text: @token }