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:
Install Composer
Install Docker Engine
Download the
php-mojeid-oidc
plugin from our public GitLab
4.1.1.1.2. Installation¶
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
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 outhttps://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.
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 toOPEN_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 serviceon the page above go to the Update link on the corresponding line
4.1.1.1.3. Application¶
Go to the example web page (https://localhost:8443/).
After potential self-signed certificate confirmation you will be redirected to the MojeID login page.
During the first login, you will be asked to agree to a data handover.
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).