These forums have been archived and are now read-only.
The new forums are live and can be found at https://forums.eveonline.com/
eve-sso-auth: no character ID returned
AH01071: Got error 'PHP message: No character ID returned\n', referer: https://login.eveonline.com/oauth/authorize?response_type=code&redirect_uri=https%3A%2F%2Fwho.drasy.de%2Fdevauthcallback.php&client_id=75037c3ab85e4e998f229d8e2d6c93c1&scope=&state=58aea04802173
AH01071: Got error 'PHP message: The requested URL returned error: 400 Bad Request\n', referer: https://login.eveonline.com/oauth/authorize?response_type=code&redirect_uri=https%3A%2F%2Fwho.drasy.de%2Fdevauthcallback.php&client_id=75037c3ab85e4e998f229d8e2d6c93c1&scope=&state=58aea4d9d35c6
{"error":"invalid_client","error_description":"Unknown client"}
{"error":"invalid_request","error_description":"Authorization code not found"}
public function setCode($code) { $this->code = $code; $url = 'https://login.eveonline.com/oauth/token'; $header = 'Authorization: Basic '.base64_encode($this->config['evesso_clientid'].':'.$this->config['evesso_code']); $fields_string = ''; $fields = array( 'grant_type' => 'authorization_code', 'code' => $code, ); foreach ($fields as $key => $value) { $fields_string .= $key.'='.$value.'&'; } rtrim($fields_string, '&'); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_USERAGENT, self::$userAgent); curl_setopt($ch, CURLOPT_HTTPHEADER, array($header)); curl_setopt($ch, CURLOPT_POST, count($fields)); curl_setopt($ch, CURLOPT_POSTFIELDS, $fields_string); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); $result = curl_exec($ch); if ($result === false) { $this->error = true; $this->message = (curl_error($ch)); } curl_close($ch); if (!$this->error){ $response = json_decode($result); $this->accessToken = $response->access_token; $this->expires = (strtotime("now")+1000); $this->refreshToken = $response->refresh_token; $result = $this->verify(); return $result; } else { return false; } }
public function verify() { if (!isset($this->accessToken)) { $this->error = true; $this->message = "No Acess Token to verify."; return false; } else { $verify_url = 'https://login.eveonline.com/oauth/verify'; $ch = curl_init(); $header = 'Authorization: Bearer '.$this->accessToken; curl_setopt($ch, CURLOPT_URL, $verify_url); curl_setopt($ch, CURLOPT_USERAGENT, self::$userAgent); curl_setopt($ch, CURLOPT_HTTPHEADER, array($header)); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); $result = curl_exec($ch); if ($result === false) { $this->error = true; $this->message = (curl_error($ch)); } curl_close($ch); if ($this->error) { return false; } $response = json_decode($result); if (isset($response->error)) { $this->error = true; $this->message = $response->error; return false; } if (!isset($response->CharacterID)) { $this->error = true; $this->message = "Failed to get character ID."; return false; } $this->characterID = $response->CharacterID; $this->characterName = $response->CharacterName; $this->scopes = explode(' ', $response->Scopes); if ($this->scopes == null || $this->scopes == '') { $this->error = true; $this->message = 'Scopes missing.'; return false; } $this->ownerHash = $response->CharacterOwnerHash; } return true; }