Sha256: e8d54eddae8419588c30e8b067b51093cb81202e94bb29526c32c3fd9a6cd792
Contents?: true
Size: 788 Bytes
Versions: 4
Compression:
Stored size: 788 Bytes
Contents
module Capcoauth module OAuth class TokenVerifier def self.verify(access_token) return nil if access_token.blank? or access_token.token.blank? return access_token if TTLCache.valid?(access_token.token) # Call Capcoauth response = HTTParty.get('https://capcoauth.capco.com/oauth/token/info', { headers: { 'Authorization' => "Bearer #{access_token.token}" } }) # Set the user_id from the token response if response.code == 200 TTLCache.update(access_token.token) access_token.user_id = response.parsed_response['resource_owner_id'] access_token else TTLCache.remove(access_token.token) nil end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems