Pages: [1] :: one page |
Author |
Thread Statistics | Show CCP posts - 0 post(s) |

Lucie Tokila
SUPERFLUOUS WANDERLUST The-Culture
0
|
Posted - 2017.06.13 19:37:08 -
[1] - Quote
Hi,
I am using the old API for a long time now I need to use SSO and ESI.
To use SSO I am developing a Web App and I need help for the retrieve token part.
I have a problem with this following method the Post Request step (the php go in this method with I receive the code from CCP and this method print the token)
function retrieveToken() { $header = 'Authorization: Basic ' . base64_encode($_SESSION['clientid'] . ':' . $_SESSION['clientsecret']); $fields_string = ''; $fields = array( 'grant_type' => 'authorization_code', 'code' => $_GET['code'] ); foreach ($fields as $key => $value) { $fields_string .= $key . '=' . $value . '&'; } rtrim($fields_string, '&'); // Build Http query using params $query = http_build_query ($fields); // Create Http context details $contextData = array ( 'method' => 'POST', 'header' => "Connection: close\r\n". "Content-Length: ".strlen($query)."\r\n", 'content'=> $query ); // Create context resource for our request $context = stream_context_create (array ( 'https' => $contextData ));
// Read page rendered as result of your POST request $result = file_get_contents ( 'https://login.eveonline.com/oauth/token', // page url false, $context); echo $result; }
with this error : file_get_contents(https://login.eveonline.com/oauth/token): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
any ideas ? :) (you can correct me because I know that I writed something wrong :/) |

Althalus Stenory
Flying Blacksmiths
123
|
Posted - 2017.06.14 10:03:47 -
[2] - Quote
$contextData = array ( 'method' => 'POST', 'header' => "Content-type: application/x-www-form-urlencoded\r\n" . $header . "\r\n", 'content'=> $query );
This "might be" enough. (You were mostly missing your auth header and also content-type)
After, if you get a 404, it seems that you don't still do POST request but GET (login/oauth/token return 404 on GET, 400 on POST without parameters).
If you can't get it to work, a solution can be to use CURL instead of file_get_contents
EsiPy - Python 2.7 / 3.3+ Swagger Client based on pyswagger for ESI
|

Lucie Tokila
SUPERFLUOUS WANDERLUST The-Culture
0
|
Posted - 2017.06.14 16:01:11 -
[3] - Quote
Thx for your repply, I tryed with Post and Get = same problem.
I delete everything and I will try with the oauth2-eveonline package.
Maybe the easy way is better for my php skills
best regard |

Minerva Arbosa
Astrocomical Warped Intentions
27
|
Posted - 2017.06.14 18:25:33 -
[4] - Quote
Just use curl. |
|
|
Pages: [1] :: one page |
First page | Previous page | Next page | Last page |