Is there a way to get test-data from ESI?

I want get test-data from the ESI from my localhost. So I can’t actually use the access points that need an acces_token.

Is there a way to get test-data from ESI?

Thx

What do you mean test-data? Like data from the test server? To do that you would just use a query param like datasource=singularity.

To get auth’d data you should go thru the OAuth flow to get yourself an access_token and refresh_token to use for the auth’d endpoints.

I think ESI also checks for CORS. So it would likely block a request from my localhost. It will probably fail to validate the domain. Because the request would come from a domain not associated with the access_token (e.g. localhost) .

CORS is only an issue when doing a client side request, like in JavaScript. Using Curl or postman it would work fine. Also you would set your callback url in your dev app the your localhost/callback url.

My requests are client-side. ( I’m using angular6 )

EDIT: My mistake, ESI allows requests from client side as it has it open:

Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: Content-Type,Authorization,If-None-Match,X-User-Agent
Access-Control-Allow-Methods: GET,HEAD,OPTIONS
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Content-Type,Warning,ETag,X-Pages,X-ESI-Error-Limit-Remain,X-ESI-Error

So you would be fine making a request from Angular.

I’m getting a 404 once I try to trade in my auth_token (in angular 6).

const httpOptions = {
  headers: new HttpHeaders({
    'Content-Type':  'application/json',
    'Authorization': 'Basic secretCode',
    'Host': 'login.eveonline.com'
  })
};
const json = {
  'grant_type':'authorization_code',
  'code': authorization_code
}
const url = 'https://login.eveonline.com/oauth/token';
this.http.post( 'https://login.eveonline.com/oauth/token', json, httpOptions )
  .subscribe();

What’s the exact error? If possible, dump the request object built by this.http.post( 'https://login.eveonline.com/oauth/token', json, httpOptions ) .subscribe(); as well. Since you’re using the json method, you need to stringify the authorization code in the content as well (I think, worth a try). https://eveonline-third-party-documentation.readthedocs.io/en/latest/sso/authentication.html#verify-the-authorization-code

I figured it out. You can’t use the server-side approach from localhost: https://eveonline-third-party-documentation.readthedocs.io/en/latest/sso/implicitflow.html#server-side-applications. But you can use the client side approach ( which I can also use to get sample data ): https://eveonline-third-party-documentation.readthedocs.io/en/latest/sso/implicitflow.html#client-side-applications

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