A token is required in order to communicate with the FastX Rest API. Below you will find different methods of generating the token when you are developing a custom client.
Login State Machine
The default method is to call /api/login This is the method the FastX Web Client uses. FastX will connect to the server and create a temporary SSH session to authenticate. This is the most robust method as it can allow you to use any authentication method your ssh server supports (with the exception of Kerberos). It is a multi state login process and and your client must keep track of the current state and send the proper responses.
Login Basic Authentication
Developers who do not want to use the login state machine can add the basic option to /api/login Basic authentication will try a username and password and will never prompt the user for more information. It will either reach the login state “success” or fail with an error.
Basic authentication works by short-circuiting the state machine on the server side. All prompts are automatically passed the password. Basic authentication will fail on systems that require dual factor authentication (eg. one time passwords) or any advanced authentication mechanism.
Command Line Token Generation
For users who are already logged in to the system, they can generate a token from the command line by using the link command located in /usr/lib/fastx2/tools/link The link command returns a json object with a result token that can then be passed to the web api