Module: Core::Helpers::Tokens
- Included in:
- Controllers::Base
- Defined in:
- lib/core/helpers/tokens.rb
Overview
This helper aims at providing vanity methods concerning OAuth tokens.
Instance Method Summary collapse
-
#token ⇒ Core::Models::Oauth::AccessToken
Returns the database object representing the current OAuth token, or raises an error if the token seems to be invalid for any reason.
Instance Method Details
#token ⇒ Core::Models::Oauth::AccessToken
Returns the database object representing the current OAuth token, or raises an error if the token seems to be invalid for any reason.
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/core/helpers/tokens.rb', line 16 def token return @token unless @token.nil? check_presence 'token' @token = Core::Models::OAuth::AccessToken.find_by(value: params['token']) api_not_found 'token.unknown' if @token.nil? token_app_id = token..application.id.to_s api_forbidden 'token.mismatch' if token_app_id != application.id.to_s @token end |