ESI auth via PHP via script?

I am diving deeper into PHP and decided I’d create a market data application that would collect information from NPC stations and public player structures. I have immediately slammed into a brick wall called oauth.

I have built the ESI url that returns a good auth code like so:

that I can stick in a browser and retrieve a code. The problem is that I want to do this programmatically when I run a script and sticking it in a browser requires me to log in with username/password and select a character.

How can I send these details programmatically so I don’t have to pull an auth code from a web site every time I run the script?

You can’t. That would defeat the purpose of OAuth. The proper way to go about this is to go thru the flow once, then save your access_token and refresh_token. You can use the refresh_token to get a new access_token programatically without needing the UI again.

See Refreshing tokens | esi-docs.

If using php I’d suggest looking into Guzzle, great module that makes it easy

Hi Agrikk,
instead of re inventing the wheel you may consider to use a prooven implementation like this package: GitHub - killmails/oauth2-eve: EVE Online Provider for the OAuth 2.0 Client

It’s a EVE Online provider implementation against a very common OAuth2 library which is GitHub - thephpleague/oauth2-client: Easy integration with OAuth 2.0 service providers.

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