Skip to Content Skip to Search
Methods
D
G
N

Attributes

[R] grant

Class Public methods

new(grant)

# File engines/oauth/app/actions/o_auth_provider/access_token_issuer.rb, line 5
def initialize(grant)
  @grant = grant
end

Instance Public methods

data()

# File engines/oauth/app/actions/o_auth_provider/access_token_issuer.rb, line 23
def data
  {
    "access_token" => @access_token,
    "token_type" => "Bearer",
    "expires_in" => @grant.expires_at.to_i - Time.zone.now.to_i,
    "refresh_token" => @refresh_token
  }
end

grant_access_token(refresh_token = false)

# File engines/oauth/app/actions/o_auth_provider/access_token_issuer.rb, line 9
def grant_access_token(refresh_token = false)
  @grant.expires_at = Time.zone.now + ACCESS_TOKEN_EXPIRATION_IN_HOURS.hours
  if refresh_token
    @refresh_token = refresh_token
  else
    create_refresh_token
  end
  create_access_token
  @grant.created_at = AUTH_CODE_EXPIRATION_IN_MINUTES.minutes.ago
  @grant.grant_type = "authorization_code"
  @grant.access_token_digest
  @grant.save
end