Skip to Content Skip to Search
Methods
N
S

Attributes

[R] grant

Class Public methods

new(client, params = {})

# File engines/oauth/app/actions/o_auth_provider/authorization_grant_creator.rb, line 5
def initialize(client, params = {})
  @grant = DB::AuthorizationGrant.find_or_initialize_by({
    site_id: params.fetch(:site_id),
    member_id: params.fetch(:member_id),
    client_id: client.client_id
  })

  @grant.scopes = params.fetch(:scope)
  @grant.grant_type = "code"
  @grant.code_redirect_uri = params.fetch(:redirect_uri)
end

Instance Public methods

save()

# File engines/oauth/app/actions/o_auth_provider/authorization_grant_creator.rb, line 17
def save
  @grant.code = generate_code
  @grant.public_id = generate_public_id
  @grant.touch(:created_at) unless @grant.new_record?
  @grant.save
end