Comments (12)
Hi @bin4ryio .
Usually, if you just want the jwt token to be dispatched in a regular sign_in and to be revoked in a regular sign_out, there is no need to manually configure jwt.dispatch_requests
neither jwt.revocation_requests
, as they are detected automatically.
Also, note that you have a typo. It is request_formats
and not requests_formats
(the extra s
).
So, I think that with following configuration it should work:
config.jwt do |jwt|
# jwt.secret = ENV['DEVISE_JWT_SECRET_KEY']
jwt.secret = "d8f531be58ad478cc79d072d6c4ea777a0c6ca5fbd9a2194b6fbfcea5f4f122017092a593f31576a0c27d9478f1bd74d336945481d22c7f9af36fd2fa6061c3d"
jwt.request_formats = { user: [:json] }
end
from devise-jwt.
Going to close it now. Feel free to come back with more questions.
from devise-jwt.
Hello, thanks the the prompt reply @waiting-for-dev. However, I have checked my devise.rb
and the typo was not there. It was written jwt.request_formats = { user: [:json] }
and the problem continue to persist.
from devise-jwt.
Can you copy/paste here which configuration do you have now?
from devise-jwt.
I still could not understand why it return unexpected ''
. May I ask if your environment is Rails API or Rails default?
Here's the gist:
https://gist.github.com/bin4ryio/7a4c9bf1b8d5ec1dbbd195dd06ad26e1
Thanks.
from devise-jwt.
No clear advice given. But I'm able to get Bearer by adding :head
on CORS config and it will not work if devise_for
has a :path api/v1/users
option. Thank you anyways.
from devise-jwt.
Someone has full example of use this gem?
from devise-jwt.
Hey @bin4ryio . Sorry, I missed your last message. This gem should work with both Rails API or default.
Happy to see now it works for you. About the path
option, it should also work with it. It would be useful if you could prepare an example application that reproduces the bug.
Cheers
from devise-jwt.
@mits87 , in spec/fixtures/rails_app/
you have an example application used for testing purposes. You only need to configure CORS on top of that if you are using cross domain requests. See rack-cors for that.
from devise-jwt.
Realize its my mistake for not reading correctly. Everything is working for intended now. Thanks for the great gem and prompt support @waiting-for-dev
I also use this to encode user's email into payload, maybe adding it to front-page to help beginner out.
def jwt_payload
{ 'email' => email }
end```
from devise-jwt.
Happy to hear that @bin4ryio :)
The information about the way to add custom claims to the payload is already in the README. Don't forget to call super
if you are using JTIMatcher
revocation strategy, though.
from devise-jwt.
@bin4ryio could u please clarify how did u return authorization header
from devise-jwt.
Related Issues (20)
- Auto removal of expired jwt token from AllowList table HOT 1
- Can't get JWT token when using devise and JWT for reset password feature HOT 7
- Devise Resource not Authenticated HOT 4
- Devise Resource not Authenticated and Authorization header missing HOT 2
- How to Avoid Session storage caveat HOT 4
- Session Store Caveat Solution? HOT 5
- [Question] Does the login function add jti value on existing database ? HOT 7
- Not getting the JWT token when signing in via a graphql-ruby mutation HOT 9
- JWT::DecodeError when passing token such as "Bearer test" HOT 7
- No content while trying to validate reset_password_token to recover password HOT 1
- current_user nil after authentication HOT 1
- Authenticate_user controller helper returns 401 regardless of token validity HOT 2
- Desive JWT import in application.rb throwing is error HOT 3
- Consider advising users to add this code to revoke the JWT on password reset HOT 3
- Feature Request: Dynamic Method for Setting JWT Expiration Time HOT 3
- Devise::JWT::TestHelpers not authenticate in rspec test HOT 4
- There is an issue with the handling of the `Authorization` HOT 2
- Error on sign_out with JWT::DecodeError (No verification key available) In Production Environment HOT 3
- version 0.12.0 does not properly add support for issuer and token_header HOT 1
- Error: SQLite3::SQLException: no such column: allowlisted_jwts.allowlisted_jwt_id HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from devise-jwt.