You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Having issue when creating access token. It is trying to save the entire token to DB. Which result in
column too long error in MySQL.
Doorkeeper config
Doorkeeper.configure do
orm :active_record
resource_owner_authenticator do
current_user || warden.authenticate!(scope: :user)
end
admin_authenticator do
if current_user
unless current_user.is_admin?
redirect_to root_url
end
else
redirect_to new_user_session_path
end
end
access_token_generator '::Doorkeeper::JWT'
enforce_configured_scopes
default_scopes :read
optional_scopes :write, :update
end
JWT config
Doorkeeper::JWT.configure do
token_payload do |opts|
user = User.find(opts[:resource_owner_id])
{
iss: 'Test',
iat: Time.current.utc.to_i,
# @see JWT reserved claims - https://tools.ietf.org/html/draft-jones-json-web-token-07#page-7
jti: SecureRandom.uuid,
user: {
id: user.id,
email: user.email
}
}
end
# Optionally set additional headers for the JWT. See
# https://tools.ietf.org/html/rfc7515#section-4.1
token_headers do |opts|
{ kid: opts[:application][:uid] }
end
use_application_secret true
encryption_method :hs512
end
When I try to get access token, its throwing MySQL error
Mysql2::Error: Data too long for column 'token' at row 1
The text was updated successfully, but these errors were encountered:
Hi,
I solved this issue by setting token as text and removed unique index on the field, since I found its not very useful in setting unique index on text field.
Hi,
Having issue when creating access token. It is trying to save the entire token to DB. Which result in
column too long error in MySQL.
Doorkeeper config
JWT config
When I try to get access token, its throwing MySQL error
The text was updated successfully, but these errors were encountered: