Module: Authkeeper::GoogleAuthApi::Requests::FetchAccessToken

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

Instance Method Summary collapse

Instance Method Details

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



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

def fetch_access_token(client_id:, client_secret:, code:, redirect_uri:)
  post(
    path: 'oauth2/v4/token',
    params: {
      grant_type: 'authorization_code',
      client_id: client_id,
      client_secret: client_secret,
      code: code,
      redirect_uri: redirect_uri
    },
    headers: { 'Content-Type' => 'application/x-www-form-urlencoded' }
  )
end