module Platforms::Core::OAuth2

This is a module for common authentication methods, across multiple platforms.

Public Instance Methods

bool_safe(val) click to toggle source

Sometimes the return value is a string “true”, while others it is cast as a boolean. This normalises that behaviour to true or false. Any non-“true” String value should return false. @param val [Object] value to convert @return boolean equivalent

# File lib/platforms/core/o_auth_2.rb, line 21
def bool_safe val
  return val == "true" if val.is_a? String
  val.eql?(true)
end
token() click to toggle source

Get the token from the OmniAuth credentials store A convenience method. @return the OmniAuth auth token

# File lib/platforms/core/o_auth_2.rb, line 12
def token
  request.env["omniauth.auth"].credentials.token
end