I'd like to combine registration with login to automatically log a user in after they are registered.
currently we call a registration route and then make the client do a second call to the doorkeeper magic route /oauth/token to login.
Could someone point me in the right direction to whatever code gets called in the /oauth/token rails route so I can call the code in my registration route and pass back the auth token?
thanks!
@pswenson
access_token = Doorkeeper::AccessToken.create(
resource_owner_id: user_id,
refresh_token: generate_refresh_token,
expires_in: Doorkeeper.configuration.access_token_expires_in.to_i,
scopes: ''
)
render json: {
access_token: access_token.token,
token_type: 'bearer',
expires_in: access_token.expires_in,
refresh_token: access_token.refresh_token,
created_at: access_token.created_at.to_time.to_i
}
def generate_refresh_token
loop do
token = SecureRandom.hex(32)
break token unless Doorkeeper::AccessToken.exists?(refresh_token: token)
end
end
Thanks!
Consider asking about it in https://stackoverflow.com/questions/tagged/doorkeeper as well, where you will get attention from more people than in this issue tracker.
Most helpful comment
@pswenson