Sha256: 57ac04a730887de760c4a570058e28e8fa6de0f83a4473b209ccbf018ad0ae85

Contents?: true

Size: 909 Bytes

Versions: 1

Compression:

Stored size: 909 Bytes

Contents

require 'omniauth-oauth2'

module OmniAuth
  module Strategies
    class Dexcom < OmniAuth::Strategies::OAuth2
      option :name, 'dexcom'

      option :client_options, {
        :site => 'https://api.dexcom.com',
        :authorize_url => 'https://api.dexcom.com/v2/oauth2/login',
        :token_url => 'https://api.dexcom.com/v2/oauth2/token'
      }

      option :scope, 'offline_access'

      info do
        {
          'auth' => oauth2_access_token
        }
      end

      def callback_url
        full_host + script_name + callback_path
      end

      alias :oauth2_access_token :access_token

      def access_token
        ::OAuth2::AccessToken.new(client, oauth2_access_token.token, {
          :expires_in => oauth2_access_token.expires_in,
          :expires_at => oauth2_access_token.expires_at
        })
      end
    end
  end
end

OmniAuth.config.add_camelization 'dexcom', 'Dexcom'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
omniauth-dexcom-oauth2-1.0.0 lib/omniauth/strategies/dexcom.rb