Sha256: 14f908afe79623d6fc874d9ad00c78cb506c38e5d285f0c58e738fb2f60c3809
Contents?: true
Size: 1.36 KB
Versions: 1
Compression:
Stored size: 1.36 KB
Contents
module OmniAuth module Strategies module BuildAccessToken def oauth2_access_token access_token_response = client.request(access_token_method, access_token_url, headers: access_token_headers, parse: :json).parsed hash = { :access_token => access_token_response["access_token"], :expires_in => access_token_response["expires_in"], } ::OAuth2::AccessToken.from_hash(client, hash) end def get_user_info @raw_info ||= JSON.load(access_token.get("https://graph.zalo.me/v2.0/me?access_token=#{access_token.token}&fields=id,birthday,name,gender,picture,phone").body) rescue ::Errno::ETIMEDOUT raise ::Timeout::Error end private def access_token_method options.client_options.token_method end def access_token_headers { "secret_key" => options.client_secret } end def access_token_url client.token_url(access_token_params) end def access_token_params {}.tap do |params| params[:redirect_uri] = callback_url params[:app_id] = options.client_id params[:code] = request.params['code'] params[:code_verifier] = options.client_options.code_verifier params[:grant_type] = options.client_options.grant_type end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
omniauth-zalo-0.1.5 | lib/omniauth/strategies/build_access_token.rb |