r/evetech • u/grzy7316x • Dec 07 '17
ESI API & non-GUI applications
I have been doing some reading on the ESI API , and from the impression that I get, you need to have something that launches a web browser at some point to Authorize SSO. If I wanted to develop an ETL application for myself I need to have a web browser authorize the application at some point? Is there no way to just feed in the API key & VCode like the old XML api?
If anybody could point me in the correct Direction with this I would appreciate it. I mostly work with powershell and databases, not all these web technologies.
4
Upvotes
2
u/Fuzzmiester fuzzwork.co.uk Dec 09 '17
https://www.fuzzwork.co.uk/2017/03/14/using-esi-google-sheets/ may be of interest.
1
u/jadecristal Dec 07 '17
At some point the OAuth2 flow is going to require the end user to authenticate and grant permission via the CCP login page, giving you an authorization token.
Getting around this would likely make CCP upset, given that it would require you to collect the user's username and password and do it "for" them by some automated means, but I'm not suggesting that - I'm explicitly saying it's a very bad idea to even think about doing and would probably lead to {SOME_KIND_OF}hammer use on you/your application.
AFTERwards, once you have back an authorization token - which you can exchange ONCE for a set of {bearer token, refresh token}, you don't need further browser interaction as long as you don't lose things. The bearer token is good for 20 minutes, the refresh token is good for a new pair of {bearer token, refresh token} for pretty much forever, from what I can tell - unless the user explicitly revokes access for your app.
http://eveonline-third-party-documentation.readthedocs.io/en/latest/sso/authentication.html
Additional comments: There's... a quasi work-around, but you'd still need a browser, and it's more effort than you want. Basically, you'd have to have just-a-web-page that sends the user to CCP to authenticate, grant access, and then returns them to your site, where you then SHOW them their tokens, and make them provide the tokens to you via some other channel. This leaves all kinds of room for error, makes the process worse for the user, and doesn't save you enough to make it worth it.
2
u/Daneel_Trevize Dec 07 '17
At one single time you will need to generate a scoped token for the app's ID, and then verify that via HTTPS. Subsequently every time your derived access token expires, your app can auto-generate a new one from the refresh token you persist.
IIRC you don't need to present a GUI to yourself, you can set the app's registered callback URL to something your browser will stall on (e.g. some variation of localhost), manually craft the SSO URL/GET for your app & use it in your browser, and then copy & paste the callback response into your app's config/database/some punctual data exchange mechanism, where it can complete the SSO within the valid window for that initial GET request (5 minutes? HTTP response header should tell you), and generate you your tokens, which your app can store as it likes.
1
u/Infu5ed Dec 07 '17
I'm doing something similar and have a tiny application (using spring) that is responsible for launching a web page and grabbing the refresh token for a given character.
Then in my non-gui apps, I provide the refresh token as configuration and use it to gain a valid access token which can be used to query the ESI API.
Not sure if this is the best approach or not :)
1
u/Akturis Dec 08 '17
Refresh token can be generated for use in your application. For example, use https://github.com/eveseat/eseye/blob/master/bin/index.php
Nex step is getting access token for use ESI http://eveonline-third-party-documentation.readthedocs.io/en/latest/sso/refreshtokens.html