All threads / Rail API Knock User Authentication

Ask A Question

Notifications

You’re not receiving notifications from this thread.

Rail API Knock User Authentication

Anand Padia asked in Rails

Application Strucutre
Rails API
user model & controller - CRUD
blog model & controller - CRUD
comments model & controller - CRUD

Standard Blog App with Knock Authentication for access Token - followed https://gorails.com/episodes/api-auth-with-json-web-tokens-and-knock

Client side App
*Rails App *
Static Pages
Blog access via API

We are using Rest-Client gem to render the Blogs from API, to get this working we have created a user controller which connects to Blogs API CRUD, now we are able to get user token and use that on subsequent calls however I am not sure how to save this token on client side.

Hey Anand,

Generally people store the JWTs client side in LocalStorage. It's like a local database stored in the browser so you can just stash it there and retrieve it later. It functions similar to cookies but you have to manually save it yourself rather than the browser taking care of cookie storage automatically for ya.

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 34,674+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.