Home > sncf.js > Client > login
Client.login() method
Logs the client in, establishing a connection to navitia.
Signature:
typescript
login(token?: string): Promise<Client>;Parameters
Parameter | Type | Description |
|---|---|---|
token | string | (Optional) the token of the account to log in with |
Promise<Client>
Example 1
Login using a token
javascript
login('YOUR_TOKEN');Example 2
Login using a token from the environment variable (SNCF_TOKEN) The token in environment variable is automatically used if no token is provided, but it must be named SNCF_TOKEN
javascript
login();