Module: Authkeeper::GitlabAuthApi::Requests::FetchAccessToken

Included in:
Client
Defined in:
app/lib/authkeeper/gitlab_auth_api/requests/fetch_access_token.rb

Instance Method Summary collapse

Instance Method Details

#fetch_access_token(client_id:, client_secret:, redirect_url:, code:) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/lib/authkeeper/gitlab_auth_api/requests/fetch_access_token.rb', line 7

def fetch_access_token(client_id:, client_secret:, redirect_url:, code:)
  post(
    path: 'oauth/token',
    params: {
      client_id: client_id,
      client_secret: client_secret,
      redirect_uri: redirect_url,
      code: code,
      grant_type: 'authorization_code'
    },
    headers: { 'Content-type' => 'application/json' }
  )
end