Module: Tibber::Authentication

Included in:
API
Defined in:
lib/tibber/authorization.rb

Overview

Deals with authentication flow and stores it within global configuration

Instance Method Summary collapse

Instance Method Details

#login(_options = {}) ⇒ Object

Authorize to the Tibber portal using the access_token



10
11
12
13
14
15
16
17
# File 'lib/tibber/authorization.rb', line 10

def (_options = {})
  raise ConfigurationError, 'Accesstoken/api-key not set' unless access_token

  # only bearer token needed will do sanity check if token is valid by callig api
  graphql_call('{viewer{name}}')
rescue GraphQLError => e
  raise AuthenticationError.new e
end