How to get a JWT Token via Oauth SSO

I get an access token and it is 4000 characters, and I need to get a jwt token, I do not know how

<?PHP
include 'app_credentials.php'; //load $secretKey, $clientID, and $base64 strings

$json = file_get_contents('access_token_refreshed.json');
$json_data = json_decode($json,true);
$refreshToken = $json_data['refresh_token'];
$accessToken = $json_data['access_token'];
 
$authURL = 'https://login.eveonline.com/v2/oauth/token';
$authPost = "grant_type=refresh_token&refresh_token=".$refreshToken;
$authHeader = array(
    "Accept: application/json",
    "Content-Type:application/x-www-form-urlencoded",
    "Authorization: Basic $base64"
    );
 
$ch = curl_init($authURL);
 
curl_setopt($ch, CURLOPT_HTTPHEADER, $authHeader);
curl_setopt($ch, CURLOPT_POSTFIELDS, $authPost);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);  
$authResponse = curl_exec($ch);
 
//echo $authResponse."\n\n";
 
if (file_exists('access_token_refreshed.json')) {
    unlink('access_token_refreshed.json'); //delete old file
}
 
$handle2 = fopen("access_token_refreshed.json","w");
fwrite ($handle2,$authResponse);
fclose($handle2);
curl_close($ch);

$rest = substr($authResponse, 17, strpos($authResponse, ',' ));
$rest1 = substr($rest, 0, -18);


$json_pilot = file_get_contents('info_pilot.json');
$json_data_pilot = json_decode($json_pilot,true);
$auURL = 'https://login.eveonline.com/oauth/verify';
$authHeader1 = array(
    "Authorization: Bearer $rest1");
$ch1 = curl_init($auURL);
 
curl_setopt($ch1, CURLOPT_HTTPHEADER, $authHeader1);
curl_setopt($ch1, CURLOPT_RETURNTRANSFER, true);  
$authResponse1 = curl_exec($ch1);

if (file_exists('info_pilot.json')) {
    unlink('info_pilot.json'); //delete old file
}
 
$handle_pilot = fopen("info_pilot.json","w");
fwrite ($handle_pilot,$authResponse1);
fclose($handle_pilot);
curl_close($ch1);

$id_pilot = $json_data_pilot['CharacterID'];


$url_wallet = 'https://esi.evetech.net/latest/characters/2115133135/assets/?datasource=tranquility&page=1';
$authHeader_wallet = array(
    "accept: application/json",
    "authorization: Bearer $rest1",
    "Cache-Control: no-cache"
    );
$ch_wallet = curl_init($url_wallet);
 
curl_setopt($ch_wallet, CURLOPT_HTTPHEADER, $authHeader_wallet);
curl_setopt($ch_wallet, CURLOPT_RETURNTRANSFER, true);  
$authResponse_wallet = curl_exec($ch_wallet);

curl_close($ch_wallet);


And when I try to use the access token I have an error “{“error”:“authentication failure”}”

I have moved your Posting to the correct Forumscategory.

Sadly, the answer is you have to request less scopes.

Thank you, the problem has been solved!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.