I have the following code to get Access token and it returns access token, but tje response contains not refresh token. What could be the reason?
$token_url = 'https://login.bigcommerce.com/oauth2/token';
$post_data = [
'client_id' => $client_id,
'client_secret' => $client_secret,
'code' => $code,
'grant_type' => 'authorization_code',
'redirect_uri' => $redirect_uri,
];
2
Answers
Searching further, I got the information that BigCommerce access tokens are generally long-lived, meaning they do not expire frequently. You might not need a refresh token if your access token is valid for an extended period.
This following code helps you to fetch the access token from the BigCommerce OAuth2 response and checks for the presence of a refresh token. Make sure that your sensitive data should be loaded from the Environment variables
BigCommerce OAuth2 implementation might not always include a refresh token in the initial response. It depends on your application configuration and permission requested.