# Connect clients

Give users the address and the sign-in, check what the clients need from the network, and connect the Desktop App or pl-cli to the Backend.

Users work with Platforma through its clients: the Desktop App (The program that each user installs on their own computer to work with Platforma. It is a client of the Backend.) for analysis, and pl-cli (The command-line client of Platforma. Administrators use it to manage users and projects on the Backend.) for administration from the command line. Each client connects to the Backend (The server program of Platforma. It keeps the projects, runs the Blocks and starts jobs.) with the address and the sign-in (To show the Backend who you are, with a sign-in provider or a single-user token. The verb is "sign in"; the noun and the adjective are "sign-in".) that you give.

## What clients need

Each client, the Desktop App and pl-cli, connects to the same address of the Backend. Give users this address:

#### Variant: Kubernetes cluster

The address is the host name of the entry point (The way in to the Backend from outside the cluster, a load balancer or an Ingress with a DNS name. It usually ends TLS and sends the traffic to the Backend pod.): `https://platforma.example.com`. The port is 443, so the address does not need it. The installer on AWS shows this address in the stack output `PlatformaUrl`.

#### Variant: Single Server

The address is the host name of the server with the API port: `https://platforma.example.com:6345`.

The network of each computer with a client must let it reach:

- **The address of the Backend.** The clients use gRPC over HTTP/2, with long streams. Each proxy, firewall and load balancer on the way must carry it. See [What each entry point must carry](/infrastructure-contract-entry-point/#what-each-entry-point-must-carry).
- **The primary storage (The bucket (Amazon S3 or Google Cloud Storage) or folder where Platforma keeps all results and uploaded files.), for the Desktop App.** The Desktop App uploads and downloads files directly. With a bucket, the computers must reach the endpoint of the bucket (see [Primary storage](/configuration-storage/#primary-storage)). In Single Server mode (The mode in which the Backend and all its jobs run on one Linux machine, the server, with no Kubernetes cluster.) with a folder as the primary storage, they must reach port 6347 of the server.
- **The Block registry (A service from which the Desktop App downloads Blocks. MiLaboratories runs the main one; a company can add its own.), for the Desktop App.** See [Outbound connections](/security-outbound-connections/).

pl-cli connects only to the address of the Backend. Each client must also trust the certificate of the address and follow the proxy rules of the network: see [Certificate and proxy](/install-connect-clients/#certificate-and-proxy).

Users sign in with the sign-in providers (A configured way for users to sign in to the Backend: single sign-on (SSO), LDAP or a static list of users. One Backend can have more than one.) of the Backend: their login in the static list of users (A sign-in provider that is a file with the logins and the password hashes of the users, in the htpasswd format. The Backend reads it again when it changes.), their LDAP (The directory of users of a company. The Backend can check logins and passwords in it.) account, or their account at the SSO (Sign-in through the identity service of the company, with the same account as for other company systems.) provider. Both clients support each provider. See [Authentication](/configuration-authentication/).

## Certificate and proxy

- **Certificate.** A certificate from a public certificate authority works in each client. A certificate of a corporate certificate authority, or a self-signed certificate, works only in a client that trusts it:

  - the Desktop App trusts the authorities in the trust store of the operating system: add the certificate there, then start the Desktop App again;
  - pl-cli trusts the authorities that come with Node.js: give it the certificate in the environment variable `NODE_EXTRA_CA_CERTS`.

  See [What clients trust](/configuration-domain-and-tls/#what-clients-trust).

- **Proxy.** Each client has its own proxy setting:

  - the Desktop App uses the proxy of the operating system by default. For the connection to the Backend, it tries the proxy and the direct way, and uses the one that works. To connect directly, select **Connect without proxy** in the connection form. For another proxy, see [Desktop App network settings](/configuration-proxy-and-custom-ca/#clients);
  - pl-cli uses the proxy of the environment variable `https_proxy`, and does not try the direct way. See [pl-cli network settings](/configuration-proxy-and-custom-ca/#pl-cli-network-settings).

## Connect

Choose the client:

#### Variant: Desktop App

1. **Install the Desktop App.** Download it for the operating system of the computer from [platforma.bio/downloads](https://platforma.bio/downloads), and install it.

2. **Add the server.** Start the Desktop App. At the first start, it opens the connection form; when it already has servers, click **Add**. In **Remote address**, type the address of the Backend, with `https://`.

   The Desktop App then asks the Backend how users sign in, and shows the fields for it.

3. **Sign in.**

   - With a static list of users or LDAP, type the **Login** and the **Password**, and click **Connect**.
   - With SSO, click **Login with SSO**: the browser opens the page of the identity provider.

   When the Backend has more than one sign-in provider, click **Use another login method** to choose one.

Result: the Desktop App shows the list of projects. It keeps the server in its list: at the next start, click the server to connect.

#### Variant: pl-cli

pl-cli signs in once and keeps the session: later commands do not ask for the sign-in. It signs in with each kind of sign-in provider: SSO in the browser, or a login and a password from a static list of users or LDAP. The sign-in and the stored sessions need Backend 3.6.0 or later.

1. **Install Node.js.** pl-cli needs Node.js 24 or later, with `npm` and `npx`.

2. **Get pl-cli.** pl-cli is the npm package `@platforma-sdk/pl-cli`. Install it once:

   ```sh
   npm install --global @platforma-sdk/pl-cli
   ```

   Or run it without installation, with `npx @platforma-sdk/pl-cli@latest` in place of `pl-cli`. `npx` gets the latest version from the npm registry.

3. **See the sign-in providers.** Write the address with `https://`: an address without a scheme connects without TLS.

   ```sh
   pl-cli login -a https://platforma.example.com --list-methods
   ```

   pl-cli shows one line for each provider of the Backend: `ID`, `KIND` (`sso`, `basic` for a password, `token`), `TITLE`, and the `ISSUER` of an SSO provider.

4. **Sign in.** Give the ID of the provider in `--method`. This option is required: pl-cli does not choose a provider for you.

   - With SSO, pl-cli opens the sign-in page of the identity provider in the browser and prints its address:

     ```sh
     pl-cli login -a https://platforma.example.com --method <id>
     ```

     The identity provider sends the browser back to pl-cli, to a port on `127.0.0.1` of the computer where pl-cli runs. The Backend gives the list of these ports. When pl-cli runs on a remote computer over SSH, forward this port from your computer, for example `ssh -L 8085:127.0.0.1:8085 <host>`. With `--no-browser`, pl-cli only prints the address of the sign-in page. pl-cli waits 300 seconds for the sign-in (`--timeout <seconds>`).

   - With a static list of users or LDAP, give the login. pl-cli asks for the password and does not show it:

     ```sh
     pl-cli login -a https://platforma.example.com --method <id> -u <login>
     ```

   - With a single-user token, pl-cli asks for the token in place of the password.

5. **Check the connection.** After the sign-in, commands do not need the address:

   ```sh
   pl-cli project list
   ```

Result: pl-cli shows the projects of the user.

**Sessions.** pl-cli keeps the sessions in the file `~/.platforma/pl-cli.sessions`. The file holds only the token that the Backend gives, not a password or the tokens of the identity provider. On Linux and macOS, only your system user can read it. A command without `-a` uses the default session: the last session that you signed in with or selected. Before each command, pl-cli checks the ID of the Backend instance at the address, and does not send a token to another instance. When the session is past half of its time, pl-cli renews it. When it has expired, run `pl-cli login` again.

| Command                                      | Result                                                                                           |
| -------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| `pl-cli session list`                        | Shows the stored sessions: instance, login, address, provider, expiry. No tokens                 |
| `pl-cli session select <login> -a <address>` | Makes the session of this login the default session                                              |
| `pl-cli session remove <login> -a <address>` | Removes the session of this login                                                                |
| `pl-cli logout`                              | Removes the default session from the file. The token stays valid on the Backend until it expires |

**Administrator commands.** The administrator commands (`pl-cli admin ...`, `pl-cli maintenance ...`) use the stored session of a user with the administrator role (The role in the Backend that can read and change the data of all users and run the pl-cli administrator commands. The operator sets rules that give it to users by login, group or attribute.), also a session made with SSO. The Backend checks the role.

**Sign-in with each command.** `-u` with `-p`, or `--admin-user` with `--admin-password` (and the environment variables `PL_USER`, `PL_PASSWORD`, `PL_ADMIN_USER`, `PL_ADMIN_PASSWORD`), sign in with a login and a password for this command only, and do not use or change the stored sessions. `-u` or `--admin-user` without a password selects the stored session of this login.

For the certificate authority and the proxy of pl-cli, see [pl-cli network settings](/configuration-proxy-and-custom-ca/#pl-cli-network-settings).

## Next

- [Verify the installation: run a test project](/install-verify/)
- [Users and roles](/configuration-users-and-roles/)

Source: https://docs.platforma.bio/install-connect-clients/
