Questions tagged [devise-token-auth]

Token-based authentication for Rails JSON APIs. Designed to work with jToker and ng-token-auth. Use this tag for questions related to Devise Token Auth.

Token-based authentication for Rails JSON APIs. Designed to work with jToker and ng-token-auth. Use this tag for questions related to Devise Token Auth.

136 questions
0
votes
1 answer

Devise Token Auth - Not returning tokens to client

Setting up devise_token_auth. Keep running in to issues in the source code. Ex: def token_validation_response as_json(except: %i[tokens created_at updated_at]) end It will be called from: SessionsController::create > render_create_success >…
user3738936
  • 936
  • 8
  • 22
0
votes
1 answer

Can't authenticate user by its token, Filter chain halted as :authenticate_user! rendered or redirected

I am trying to get current_user but non the user is authenticated by header on API request. Header include access-token, client and uid but it doesn't authenticate and shows following errors: For reference please check this repo Filter chain halted…
SahSantoshh
  • 73
  • 2
  • 12
0
votes
0 answers

Devise Token Auth - Permanent token?

Is there a way to generate a permanent token with Devise Token Auth, aside from changing the token_lifespan setting? I have an user oriented api that requires login but I also need to set up the same api to be used on integrations, with token…
xSlok
  • 589
  • 8
  • 23
0
votes
2 answers

Extending Rails Application Controllers for Active Admin and devise_token_auth

I am trying to implement both devise_token_auth and Active Admin in my rails api back-end. There are pretty clear instructions on the devise_token_auth FAQ explaining how to implement the two together - it requires two different Application…
dmanaster
  • 579
  • 1
  • 6
  • 16
0
votes
1 answer

Devise token Auth response does not include manually generated header tokens

I had to implement my own confirmations_controller because I use cellphone instead of email. # controllers/verifications_controller.rb class VerificationsController < ApplicationController def verification # ... ops related to verification…
David
  • 97
  • 9
0
votes
1 answer

Auth headers not set using angular-token

I just started with an angular app using angular-token and a rails back-end with devise-token-auth, I have the next "on-submit" in a sign-in component: onSubmit() { this.output = null; this.tokenService.signIn(this.signInData).subscribe( …
Fito
  • 478
  • 4
  • 10
0
votes
2 answers

devise_token_auth with devise for non-devise routes

I'm trying to get devise + devise_token_auth to work together using the 'enable_standard_devise_support = true' and without the need to duplicate every controller one for web and one for API. I turn on standard devise support in the initialiser …
map7
  • 5,096
  • 6
  • 65
  • 128
0
votes
2 answers

DRY concepts in rails controllers

I'm working on my first rails api server. I've got a controller for my User model that looks as such: class UsersController < ApplicationController def index if current_user.admin? @users = User.all render json: @users else …
0
votes
1 answer

Rails returning 401 Unauthorised for User Auth Flow - Rails, devise gem, Devise_token_auth gem

Giving my first go at linking my React Native front end to my rails API back end. To do this I'm working with a user authentication flow and more specifically, signing in (creating the user on the database via User.create and a User model). I've set…
0
votes
0 answers

Routing error upon overriding registrations controller in Rails API using devise token auth

I am trying to send a POST request (using Postman) to sign up a new user using devise token auth and I am overriding the registrations controller to enable my own JSON responses. I keep getting a routing error: "status": 404, "error": "Not…
0
votes
0 answers

How would I create JSON responses in Rails API Controller to be used in React Native after checking sign up parameters?

Setup : Front end => React Native Back end => Rails API Context: I'm trying to create a user authentication flow using devise & devise-token-auth. My routes and requests seem to be working in the rails console & using Postman however I would like…
0
votes
0 answers

How to force logout a user other then current_user using devise

I need to create a functionality at admin site which allow an admin to force_logout any user. I am using devise token based authentication and tried sign_out user method, It does not work.
Vishal
  • 113
  • 2
  • 14
0
votes
1 answer

How do i open up API requests to my app with devise_token_auth?

I am using devise_token_auth in my rails app. I am looking to open up apis to my app using user specific tokens which would give them limited access to certain apis within my app. It should work similar to current public key and private key settings…
Venomoustoad
  • 1,203
  • 1
  • 14
  • 38
0
votes
1 answer

token lifespan is not working with devise auth token gem and devise in rails grape api

I have a rails-grape api application that has been authenticated with devise. Now I am trying to implement auto-session timeout with the apis. For that I have implemented the devise_auth_token gem. My devise_auth_token.rb DeviseTokenAuth.setup do…
0
votes
1 answer

Why are access tokens invalidated after each request?

The devise_token_auth docs say that "Tokens should be invalidated after each request to the API." https://github.com/lynndylanhurley/devise_token_auth/blob/master/docs/conceptual.md#about-token-management But why? What is the risk if tokens are not…