$client_id, 'client_secret' => $client_secret, 'code' => $code ])); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); $data = json_decode($response, true); if (isset($data['access_token'])) { $_SESSION['access_token'] = $data['access_token']; setcookie("access_token", $data['access_token'], time() + 7*24*60*60, "/", "", true, true); header("Location: profile.php"); exit; } else { echo "Failed to log in!"; } ?>
Something went wrong logging you in :(