Add user transient attribute to oauth_access_token factory

This commit is contained in:
Anton Khorev 2025-01-23 17:43:30 +03:00
parent 3f62d67684
commit ef648a53ba
6 changed files with 18 additions and 14 deletions

View file

@ -138,7 +138,7 @@ module ActiveSupport
def bearer_authorization_header(token_or_user = nil, scopes: Oauth::SCOPES)
token = case token_or_user
when nil then create(:oauth_access_token, :scopes => scopes).token
when User then create(:oauth_access_token, :resource_owner_id => token_or_user.id, :scopes => scopes).token
when User then create(:oauth_access_token, :user => token_or_user, :scopes => scopes).token
when Doorkeeper::AccessToken then token_or_user.token
when String then token_or_user
end