Refresh Token

(Salvitorius Grave) #1

I am working on getting the SSO to work on my web application. I get the code and exchange it for a token. However the refresh token is null. Is there a way to make it request the refresh token at the same time or is it a separate request?

Working with PHP/JSON if that’s any help.

(Blacksmoke16) #2

It should come back with your access token IF you requested any valid scope.

(Salvitorius Grave) #3

I get the access token. Looking for the refresh.

(Blacksmoke16) #4

Yes i know that. The refresh token should be included with your access token. But you have to request at least one valid scope. i.e if you dont request any scopes there is no need for an refresh token so it isn’t included.

(Salvitorius Grave) #5

yeah, sorry just reread your post and noticed the ‘scope’ issue. I forgot to include a scope in the request. ty for the assist though. :slight_smile:

(Blacksmoke16) #6

No problem :slight_smile: got one now?

(Salvitorius Grave) #7

Yep, and ran through the GET request for validation. Everything is moving smoothly now. Ty for your help!

(Blacksmoke16) #8

:+1: No problem.

(Salvitorius Grave) #9

Maybe you can help with another issue i’m coming up with. Trying to pull the corp killmails I keep getting a backend 404. Made sure it is a get request function of ESI. I know for a fact there are kills so it wouldn’t be an empty table. Verified the corp ID is valid. I’m passing a refresh token as “Authorization: Bearer dfasd…oinoaisndf”.

		$headers = array(
			"Authorization: Bearer  ".$_SESSION['token'],
			"Content-Type: application/json",
		// Start cURL request
		$ch = curl_init("".$_SESSION['corpID']."/killmails/recent/");
		curl_setopt($ch, CURLOPT_HEADER, $headers);
		curl_setopt($ch, CURLOPT_USERAGENT, $_SESSION['user_agent']);
		curl_setopt($ch, CURLOPT_HTTPGET, true);
		curl_setopt($ch, CURLOPT_FRESH_CONNECT, true);
		curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

		$result = curl_exec($ch);
		$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
		if($httpCode != 200) {
		    print  "Failed to pull killmail!";
	    if (curl_errno($ch)) { 
	        print "Error: " . curl_error($ch); 

(Blacksmoke16) #10

At first glance it looks like you have two spaces after Bearer in your headers array. Not sure if that is the cause just something i noticed.

My vote to the issue is your $_SESSION['corpID'] isn’t actually resolving to anything and is making the endpoint like which obs doesn’t exist, hence the 404.

Another tip, instead of using /latest/ use the version of the endpoint, such as /v1/ so when the definition of latest changes, your code doesn’t break.

(Salvitorius Grave) #11

I did end up getting the request to work but this is developing into a new issue. Going to start a new thread to keep this clean.

(system) #12

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