Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validate_token Works but nothing else... #899

Closed
phspies opened this issue Jun 6, 2017 · 3 comments
Closed

validate_token Works but nothing else... #899

phspies opened this issue Jun 6, 2017 · 3 comments

Comments

@phspies
Copy link

phspies commented Jun 6, 2017

I'm running rails 5.1.1 with devise_token_auth 0.1.42.

It seems I can signin, validate-token but no other route seems to work. Below is the validate-token and a route that uses the same tokens but the "authenticate_user" route doesn't want to allow access.

Any ideas?

Started GET "/auth/validate_token" for 192.168.0.25 at 2017-06-06 17:21:17 -0400 Processing by DeviseTokenAuth::TokenValidationsController#validate_token as JSON ------------ {"HTTP_VERSION"=>"HTTP/1.1", "HTTP_ACCEPT_ENCODING"=>"gzip,deflate", "HTTP_ACCESS_TOKEN"=>"OXP5v8MczW1gkhldzM5l2Q", "HTTP_CLIENT"=>"dyStvPzh7dDu_kCjGLPVEg", "HTTP_TOKEN_TYPE"=>"Bearer", "HTTP_UID"=>"[email protected]", "HTTP_COREENGINE_ID"=>"df10ee0f24819bc1692e4360f36a369c9857689b", "HTTP_EXPIRY"=>"1499203277", "HTTP_ACCEPT"=>"application/json", "HTTP_USER_AGENT"=>"RestSharp/105.2.3.0", "HTTP_HOST"=>"192.168.0.100:3000"} User Load (0.5ms) SELECT users.* FROM usersWHEREusers.uid= '[email protected]' LIMIT 1 User Load (0.7ms) SELECT users.* FROM usersWHEREusers.id = '7133fdaaa4ef26c5141692c9401cbddbd1830636' LIMIT 1 (0.1ms) BEGIN (0.1ms) COMMIT Completed 200 OK in 81ms (Views: 0.3ms | ActiveRecord: 1.5ms)

Started GET "/api/v01/organization/af06fb7a18fb84455b722385f2c31b0bf7dba066.json" for 192.168.0.25 at 2017-06-06 17:21:17 -0400 Processing by Api::V01::OrganizationController#show as JSON Parameters: {"id"=>"af06fb7a18fb84455b722385f2c31b0bf7dba066"} ------------ {"HTTP_VERSION"=>"HTTP/1.1", "HTTP_ACCEPT_ENCODING"=>"gzip,deflate", "HTTP_ACCESS_TOKEN"=>"OXP5v8MczW1gkhldzM5l2Q", "HTTP_CLIENT"=>"dyStvPzh7dDu_kCjGLPVEg", "HTTP_TOKEN_TYPE"=>"Bearer", "HTTP_UID"=>"[email protected]", "HTTP_COREENGINE_ID"=>"df10ee0f24819bc1692e4360f36a369c9857689b", "HTTP_EXPIRY"=>"1499203277", "HTTP_ACCEPT"=>"application/json", "HTTP_USER_AGENT"=>"RestSharp/105.2.3.0", "HTTP_HOST"=>"192.168.0.100:3000"} Completed 401 Unauthorized in 1ms (ActiveRecord: 0.0ms)

@phspies
Copy link
Author

phspies commented Jun 7, 2017

Ok it seems devise_token_auth wants to use Cookies and when you use that, the authentication seems to work.

Question is how can one for only the use of tokens and not use cookies at all?

@nicholasshirley
Copy link

I'm using the same version and I haven't found that I need cookies. Here's a link to a test repo I made when I was testing the gem before I put it into a project. It has React on the front end and it's not really complete, but you can test basic sign_in and then create and retrieve a note using just the headers for auth. I don't know what validate token does, I never use this route.

https://github.com/nicholasshirley/gem-auth-test

@zachfeldman
Copy link
Contributor

Thanks @nicholasshirley ! Closing this issue for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants