hayfever / sorcery-jwt Goto Github PK
View Code? Open in Web Editor NEWJWT extension for the Sorcery authentication gem
License: MIT License
JWT extension for the Sorcery authentication gem
License: MIT License
in Gemfile:
gem 'sorcery', '~> 0.16'
bundle update sorcery
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Bundler could not find compatible versions for gem "sorcery":
In Gemfile:
sorcery (~> 0.16)
sorcery-jwt was resolved to 0.1.12, which depends on
sorcery (>= 0.13, < 0.16)
Sorcery resolved ruby 2.7.x deprecation warnings (among other things) starting in version 0.16.0: https://github.com/Sorcery/sorcery/releases/tag/v0.16.0
Sorcery/sorcery#241
I realize https://github.com/Sorcery/sorcery-rework will support jwt
, but appears to be stalled. Can we catch up with core sorcery in the meantime?
Thanks so much for all your JWT work!
The link to jwt_revocation_strategies is sadly no longer working.
The login_and_issue_token
method is limited to controllers, so can't be used in GraphQL mutations
I tried to log out using the sorcery method (logout) but it just updates some columns from the user but if I continue using the JWT token it will be valid until it expired by the date, not respecting the logout method.
Any idea?
Hi,
I have a simple setup of sorcery
and sorcery-jwt
with following details.
Rails.application.config.sorcery.submodules = [:jwt, :reset_password, :user_activation, :activity_logging]
.....
.....
.....
config.user_config do |user|
user.jwt_secret = Rails.application.credentials.dig(Rails.env.to_sym, :jwt_key)
user.jwt_algorithm = 'HS256' # HS256 is used by default.
end
On controller
class ApiController < ActionController::API
end
class TokensController < ApiController
def create
token = login_and_issue_token(params[:email], params[:password])
json_response(token, 200)
end
end
When controller action is called it throw following error.
NoMethodError: undefined method `login_and_issue_token' for #\u003cTokensController:0x00007ffbd60a0b20\u003e\u003e"
If I already have a user, say from an oauth login, is it possible to retrieve the token for that user?
I tried @token = login_and_issue_token(@user.email, @user.crypted_password)
but that just returns nil.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.