Skip to content
This repository was archived by the owner on Jan 21, 2022. It is now read-only.

Tokens: Automatic

Josh Freeman edited this page Jun 4, 2019 · 1 revision

This describes the process of automatically logging into a SE account using a valid Username and Password. No information leaves your PC and it uses the secure login form, this process simply automates submitting the login form for you.

This allows you to setup a more automated approach where you schedule a token to be logged in daily.


To smooth out automation, you can have the library log into the companion app for you, like so:

use Companion\CompanionApi;

// Initialise the API. We provide no token parameter so it creates a blank one
$api = new CompanionApi(');

// Login to our account
$api->Account()->login('Username', 'Password');

At this point you can save your token as it will have been updated

$sightToken = $api->Token()->get();

// json encode it
$sightToken = json_encode($sightToken);

// save it
file_put_contents(__DIR__.'/my_token.json', $sightToken);

You can save the JSON Encoded/Serialised version of SightToken anywhere (db, s3, file, etc..)

Clone this wiki locally