PHP Instagram API始终返回“找不到匹配的代码”。

i Googled around but could not find the right answer! Thought it would be from my end or is it from Instagram?

  1. Login to Instagram and access granted then redirect back to return URL with the code
  2. API returns user details for the first time but when I refresh the page the API is always return 'No matching code found'?

I store the return instagram code as a session:

Instagram API class from: https://github.com/cosenary/Instagram-PHP-API

if ( isset($_GET['code']) ) {
   $_SESSION['instagram'] = $_GET['code'];

   $data = $instagram->getOAuthToken($_SESSION['instagram']);

   if ( $data->code == 400 ) {
        echo $data->error_message;
    } else {
        echo 'Your username is: ' . $data->user->username;
    }
}