Open jvalenciag opened 5 years ago
Could you explain your use case better ?
Same question here, we have either Driver
or Client
and I can find no way from the options hash that is yielded to the token_payload
to the actual owner.
I saw in the docs that token_payload could be configured. So you can add the "role" field or any field into access token as your expect.
User model: { id: int, email: string, role: ["driver"] }
Doorkeeper::JWT.configure do
...
token_payload do |opts|
user = User.find(opts[:resource_owner_id])
{
...
user: {
id: user.id,
email: user.email,
role: user.role
}
}
end
...
end
I don't know how to make this gem work with multimple models for auth, how do I differentiate when generating the token?