Class: Authkeeper::Providers::Gitlab

Inherits:
Object
  • Object
show all
Defined in:
app/services/authkeeper/providers/gitlab.rb

Instance Method Summary collapse

Instance Method Details

#call(params: {}) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'app/services/authkeeper/providers/gitlab.rb', line 11

def call(params: {})
  access_token = fetch_access_token(params[:code])
  return { errors: ['Invalid code'] } unless access_token

  user = (access_token)

  {
    result: {
      uid: user['id'].to_s,
      provider: 'gitlab',
      login: user['username'],
      email: user['email']
    }
  }
end