Class: Oa2c::AccessToken

Inherits:
Object
  • Object
show all
Includes:
Mongoid::Document, OAuth2Token
Defined in:
app/models/oa2c/access_token.rb

Instance Method Summary collapse

Methods included from OAuth2Token

#expire!, #expires_in

Instance Method Details

#to_bearer_token(with_refresh_token = false) ⇒ Object



8
9
10
11
12
13
14
# File 'app/models/oa2c/access_token.rb', line 8

def to_bearer_token(with_refresh_token = false)
  Rack::OAuth2::AccessToken::Bearer.new(access_token: token, expires_in: expires_in).tap do |bearer_token|
    if with_refresh_token
      bearer_token.refresh_token = create_refresh_token(user: user, client: client).token
    end
  end
end