These docs are for v2.5. Click to read the latest docs for v3.0.

Discussions

Ask a Question
Back to All

How to get the Refresh Token using private_key_jwt

Hi,

PHP Laravel I am using.

I am using the private_key_jwt token endpoint for creating the authorization url. When I get the authorization code and I call the authorization_code request to get the access_token and other things.

I am not getting the refresh token, Could you please let me know how can i acheive the refresh token using private_key_jwt token end point.

$postData = array(
'client_id' => $this->clientId,
'redirect_uri' => $this->MoneyCallBack,
'response_type' => 'code id_token',
'scope' => 'openid offline_access id:test',
'state' => $userId,
'nonce' => "'.$randomKey.'",
'client_assertion_type' => $this->ClientAssertionType,
'client_assertion' => $token,
'claims' => json_encode(array(
'id_token' => array(
'sub' => array(
'essential' => true
),
'mh:con_id' => array(
'essential' => true
)
)
))
);

$client = new Client();
$requestURL = $this->MoneyHubUrl."/request";
$response = $client->request('POST', $requestURL, [
'form_params' => $postData
]);

This code I am using for getting the authorization url, on which I will click and get the authorization code.

$postData = array(
'grant_type' => 'authorization_code',
'code' => $_GET['code'],
'redirect_uri' => $this->MoneyCallBack,
'client_id' => $this->clientId,
'client_assertion' => $token,
'client_assertion_type' => $this->ClientAssertionType,
);
$client = new Client();
$response = $client->request('POST', $tokenURL, [
'form_params' => $postData
]);

I am using this code to get the access token, but refresh token is not getting.

Please help.