Skip to content

twf login

Log in with your browser.

Terminal window
twf login [options]

twf login opens the Twinfield login in your browser and catches the redirect on http://localhost:8765/callback. It waits up to 5 minutes. After the login it stores the tokens in the credentials file, under the profile you chose.

By default the login goes through Twinfield Connect, so you do not need a Twinfield client ID. The first login registers the Twinfield CLI with Twinfield Connect, once per machine.

A login for a profile that already exists replaces it.

Option Description
--profile=<name> The profile to store the login under, see Profiles. Default: TWINFIELD_PROFILE or default.
--manual Do not open a browser and do not listen on localhost. The command prints the login URL and asks you to paste the URL your browser was redirected to. For a machine without a browser, e.g. over SSH.
--rest Also ask for all scopes of the REST API.
--scopes=<scopes> Ask for exactly these scopes, separated by spaces: --scopes="openid twf.user".
--client-id=<id> Your own Twinfield client instead of Twinfield Connect. Default: TWINFIELD_CLIENT_ID.
--client-secret=<secret> The secret of your own client. Default: TWINFIELD_CLIENT_SECRET.
--redirect-uri=<uri> The redirect URI of the login. Default: TWINFIELD_REDIRECT_URI or http://localhost:8765/callback.
--connect-url=<url> A Twinfield Connect you run yourself. Default: TWINFIELD_CONNECT_URL.

See twf for the options every command takes.

Without --rest or --scopes the login asks for the scopes that identify you and keep the session: openid, twf.user, twf.organisation, twf.organisationUser and offline_access. These are enough for the XML web services, such as twf process-xml and twf office list.

Log in with your browser:

Terminal window
vendor/bin/twf login
Opening the Twinfield login in your browser…
If it does not open, visit: https://…
Waiting for the login on http://localhost:8765/callback (max 300 seconds)…
Logged in to Twinfield.
Organisation: EXAMPLE
User: JDOE
Profile: default
Saved in: /home/jdoe/.config/twinfield/credentials.json
Use it in PHP:
$twinfield = Twinfield::create(Credentials::default());

Over SSH, paste the redirected URL yourself:

Terminal window
vendor/bin/twf login --manual

A login for another organisation:

Terminal window
vendor/bin/twf login --profile=acme

With all scopes of the REST API:

Terminal window
vendor/bin/twf login --rest

With your own Twinfield client:

Terminal window
vendor/bin/twf login --client-id=… --client-secret=… --redirect-uri=http://localhost:8765/callback
Made by SolveBeam

Twinfield and Wolters Kluwer are trademarks of Wolters Kluwer. Their names and logos are used only to refer to their products.