Installation Code Expiry Date

oauth

#1

Hi,
What is the authorization code expiry date during installation the app in client instance?


#2

Anyone can help me here?


#3

Hi @arminsolo

The auth code will expire 10 minutes after it’s generated, so you’ll want to make sure that you’re generating the refresh token and initial access token before that (though generally you should be doing that as soon as your app gets that code).


#4

@dadams
Thank you for your reply!!
Can we increase the expiry time frame from our end or it is standard timing from your end and it is not changeable. The reason is we would like to give authorization URL to our customers to install the app however due to timing zone difference, the code will be expired when customer come back to us.


#5

Hi, this is a different problem .

Hi, I wrote the code and received this json response:

{“refresh_token”:“xxx-xx-xx-xx-xx”,“access_token”:“xxxx”,“expires_in”:21600}

but access token is not getting stored on $myrs variable.

Here is the full code :

$cod=$_GET[“code”];

$url=“https://api.hubapi.com/oauth/v1/token?grant_type=authorization_code&client_id=x-x-x-x-x&client_secretxxxx&redirect_uri=https://www.myurl.com&code=”.$cod;

$agent= ‘Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.0.3705; .NET CLR 1.1.4322)’;

$ch = curl_init();
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, “POST”);
curl_setopt($ch, CURLOPT_HTTPHEADER, [‘Content-Type: application/x-www-form-urlencoded’]);
curl_setopt($ch, CURLOPT_USERAGENT, $agent);
curl_setopt($ch, CURLOPT_URL,$url);

$result=curl_exec($ch);

$rest= (json_decode($result, true));
$myrs=$rest[“access_token”];

How can i store the access token in a variable ?

Thank you!