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



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

def (options = {})
  raise ConfigurationError, "Accesstoken/api-key not set" unless access_token
  # only bearer token needed
  # will do sanity check if token if valid
  graphql_call('{viewer{name}}')
rescue GraphQLError => e
  raise AuthenticationError.new e
end