> Source: https://docs.cyberelements.io/bastion/4.7/no/Usage/Configuration/AdminConsole/CreatePairingTokenForEdgeGateway/

# Creating a pairing token for an Edge Gateway

To create a pairing token, you need to create a new Edge Gateway or HTML5 Gateway (or edit an existing Edge Gateway or HTML5 Gateway by recreating a pairing token).

Access the web interface of the Mediation Controller server with the `/console` URI.

> **Examples**
>
> If access to the Mediation Controller on its web IP address is `10.0.10.10`, then the administration console is reached at https://10.0.10.10/console.
>
> If the Mediation Controller is reachable by a DNS name, for example `cyberelements-bastion.domain.local`, then the administration console is reached at https://cyberelements-bastion.domain.local/console.

Once logged in, follow the steps below according to your platform type and the type of Edge Gateway that needs to be created.

**Edge Gateway**

> > **Required prerequisites**
> >
> > In order to successfully create a new Edge Gateway, you must obtain at least one certificate for the Edge Gateway connection and a second optional certificate for the direct access recording service to function.
> >
> > The certificate for the Edge Gateway must be a client authentication certificate and have a CN in the form `edge-gateway-name@organization-name`. Where:
> >
> > - `edge-gateway-name` corresponds to the logical name of the Edge Gateway (since a single Edge Gateway machine can have several instances running in parallel, the name of the Edge Gateway may differ from the name assigned to the machine). The name must not contain accented characters or spaces, and the only special characters allowed are `-` and `_`.
> > - `organization-name` corresponds to the name of the organisation to which the Edge Gateway will connect. Since a Mediation Controller can have several organisations, this information is essential for it to know which organisation it is attached to.
> >
> > The certificate for the recording service must be a server authentication certificate whose CN is the FQDN of the Edge Gateway machine, never the `edge-gateway-name@organization-name` form. This FQDN must be resolved by DNS from the servers that host the direct recording agent: they reach the Edge Gateway by this name.
> >
> > Please note that the Mediation Controller will reject any certificate that does not come from a trusted PKI/certification authority. To add a new trusted PKI/certification authority, please follow the instructions on the following page: [Add a trusted certificate authority](https://docs.cyberelements.io/bastion/4.7/no/Usage/Configuration/SystemConsole/AddANewTrustedCA/)
>
> 1. Open the Edge Gateway management module: ![](https://docs.cyberelements.io/bastion/4.7/img/cyberelements/CYE_Install_Admin_Synoptic_OpenGateways.png)
> 2. Create a new Edge Gateway by clicking on the + icon: ![](https://docs.cyberelements.io/bastion/4.7/img/cyberelements/CYE_Install_Admin_Gateways_Add.png)
> 3. Fill in the various fields requested by the interface: ![](https://docs.cyberelements.io/bastion/4.7/img/cyberelements/CYE_Install_Admin_Gateways_AddForm.png)
>     1. Name the new Edge Gateway.
>     2. Optionally, enter a description to better identify it or understand its use.
>     3. Define the FQDN of the machine. This is important information that must match the CN of the certificate for the recording service.
>     4. Check the option to create a pairing token.
>     5. In `SSL certificate`, select the Edge Gateway certificate (`pkcs12` format by default), then enter its password in `Certificate or private key password`.
>     6. Optionally (recommended when creating the first Edge Gateway instance on the machine), check `Import a Careserver certificate`, then add the recording service certificate in `Careserver certificate` with its password.
> 4. The pairing token is then generated and displayed on the screen: ![](https://docs.cyberelements.io/bastion/4.7/img/cyberelements/CYE_Install_Admin_Gateways_PairingToken.png)

**HTML5 Gateway**

> > **Required prerequisites**
> >
> > In order to successfully create a new HTML5 Gateway, you must obtain a certificate for connecting to it.
> > The certificate for the HTML5 Gateway must be a client authentication certificate and have a CN in the form `html5-gateway-name@organization-name`. Where:
> >
> > - `html5-gateway-name` corresponds to the logical name of the HTML5 Gateway (since a single HTML5 Gateway machine can have several instances running in parallel, the name of the HTML5 Gateway may differ from the name assigned to the machine). The name must not contain accented characters or spaces, and the only special characters allowed are `-` and `_`.
> > - `organization-name` corresponds to the name of the organisation to which the HTML5 Gateway will need to connect. Since a Mediation Controller can have several organisations, this information is essential for it to know which organisation it is attached to.
> >
> > Please note that the Mediation Controller will reject any certificate that does not come from a trusted PKI/certification authority. To add a new trusted PKI/certification authority, please follow the instructions on the following page: [Add a trusted certificate authority](https://docs.cyberelements.io/bastion/4.7/no/Usage/Configuration/SystemConsole/AddANewTrustedCA/)
>
> 1. Open the HTML5 Gateway management module: ![](https://docs.cyberelements.io/bastion/4.7/img/cyberelements/CYE_Install_Admin_Synoptic_OpenHtml5Gateways.png)
> 2. Create a new HTML5 Gateway by clicking on the + icon: ![](https://docs.cyberelements.io/bastion/4.7/img/cyberelements/CYE_Install_Admin_Html5Gateways_Add.png)
> 3. Fill in the various fields requested by the interface: ![](https://docs.cyberelements.io/bastion/4.7/img/cyberelements/CYE_Install_Admin_Html5Gateways_AddForm.png)
>     1. Name the new HTML5 Gateway.
>     2. Specify the access URL (for a first instance in standalone architecture, this is commonly `HTML5`; for a cluster, it is `HTML5-1` and `HTML5-2`).
>     3. Optionally, enter a description to better identify it or understand its use.
>     4. Select the protocol: `WebSocket`, recommended, or `HTTP` (historical mode, proposed by default); the configuration of the Mediation Controller depends on it.
>     5. Check the option to create a pairing token.
>     6. In `SSL certificate`, select the HTML5 Gateway certificate (`pkcs12` format by default), then enter its password in `Certificate or private key password`. The two following fields become available once a valid certificate is selected.
>     7. Define the pairing token's validity period.
>     8. Optionally, restrict the use of the token to an IP address. Please note that this is the IP address seen by the Mediation Controller. If the HTML5 Gateway is part of the same network as the Mediation Controller, it will probably be the private IP address; otherwise, it will be the public IP address.
> 4. The pairing token is then generated and displayed on the screen: ![](https://docs.cyberelements.io/bastion/4.7/img/cyberelements/CYE_Install_Admin_Gateways_PairingToken.png)

> **Tip**
>
> If the token has been lost or could not be retrieved after creation, editing the settings of the new Edge Gateway will display it again.

Once the pairing token has been obtained, it can be used on an Edge Gateway or HTML5 Gateway with the following instructions: [Connecting an Edge Gateway with a pairing token](https://docs.cyberelements.io/bastion/4.7/no/Usage/Configuration/EdgeGateway/ConnectAnEdgeGatewayWithPairingToken/).
