Code Monkey home page Code Monkey logo

Comments (5)

nason avatar nason commented on June 1, 2024

Hi @kikuchiyo,

You're right. I don't think I documented authentication well enough for this project. I would update /db/seeds.rb (I just realized much of that configuration is specific to this particular application...) and

At the very least, update the admin account to your own, and the user1 and user2 seeds can stay or go. Then run rake db:reset db:seed

Once you have your accounts in order you can access your login token by sending a POST request to http://localhost:#{som_port}/v1/auth/login/ for example:
curl -X POST -F 'session[email][email protected]' -F 'session[password]=test_password' http://0.0.0.0:3000/v1/auth/login

This will return a response with an authorization token that should be used for all subsequent requests, and allow you to access the other endpoints.

from bridgely-api.

kikuchiyo avatar kikuchiyo commented on June 1, 2024

Thanks @nason

from bridgely-api.

kikuchiyo avatar kikuchiyo commented on June 1, 2024

@nason, it's giving me back the same authorization_token I had been testing with earlier ( obtained via rails console ). Should I be able to do this ( assuming the correct authorization_token ) or should I pass a differently named parameter?

curl -G -d 'authorization_token=#{my_token_here}' http://localhost:3000/v1/companies/1/employees.json

from bridgely-api.

nason avatar nason commented on June 1, 2024

The authorization token is expected in the request header, so your example won't work but something like this should:
curl -G -H 'Authorization:Token {your_token_here}' http://localhost:3000/v1/companies/1/employees.json

from bridgely-api.

kikuchiyo avatar kikuchiyo commented on June 1, 2024

perfect! thanks again @nason

from bridgely-api.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.