4.1.1.1. MojeID login via PHP client

This manual contains the procedure for installing the plugin for logging into MojeID via PHP client and an example of how to use it.

4.1.1.1.1. Prerequisites

Before you can proceed, you need to do the following:

4.1.1.1.2. Installation

  1. In the php-mojeid-oidc plugin folder run the following commands:

    cd php
    composer install
    
    # create a config file for a specific service
    cp config.{template,local}.php
    
    # start a web server
    sudo docker compose -f ../docker/docker-compose.yml up
    
  2. Do the manual MojeID client registration.

    • In the list of URIs fill out URI, that your internet browser uses to access PHP application (folder php from this example). If using the provided docker solution on your own computer you can fill out https://localhost:8443/.

      • You can find the address the web server uses from the OpenIDConnectClient::getRedirectURL() method.

      • If it does not match what you need, set the correct address using the OpenIDConnectClient::setRedirectURL() method.

  3. In the config.local.php file fill out the requested data:

    • OPEN_ID_PROVIDER_URL is the base URL of the service to which you want to connect to

    • OPEN_ID_CLIENT_ID is the Client ID from the page https://mojeid.regtest.nic.cz/consumer_admin/

    • OPEN_ID_CLIENT_SECRET is the Client secret from the page with the details of the service

      • on the page above go to the Update link on the corresponding line

4.1.1.1.3. Application

  1. Go to the example web page (https://localhost:8443/).

  2. After potential self-signed certificate confirmation you will be redirected to the MojeID login page.

  3. During the first login, you will be asked to agree to a data handover.

  4. Once agreed you will be redirected back to your application page, where first name of filled user will be displayed uvidíte křestní jméno zadaného uživatele (if you have given the appropriate consent).