lib/omniauth/strategies/nexaas_id.rb in omniauth-nexaas_id-0.2.0 vs lib/omniauth/strategies/nexaas_id.rb in omniauth-nexaas_id-0.2.1

- old
+ new

@@ -49,10 +49,15 @@ def request_phase options[:authorize_params][:scopes] = options['scope'] || DEFAULT_SCOPE super end + def list_emails? + options[:list_emails] || options['list_emails'] || + options[:client_options][:list_emails] + end + protected def build_access_token if (token = super) && token.params @api_token = token.params['api_token'] @@ -68,10 +73,10 @@ acc['emails'] = retrieve_emails(acc['id']) acc end def retrieve_emails(id) - return unless options[:list_emails] # guard: access endpoint only if allowed + return unless list_emails? # guard: access endpoint only if allowed emails = access_token.get('/api/v1/profile/emails').parsed got = email['id'] raise "unexpected id #{got} retrieving e-mails for #{id}" unless got == id emails['emails']