Skip to main content

Rail API Knock User Authentication

Rails • Asked by Anand Padia

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.


Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 22,346+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.