1. Go to this page and download the library: Download brenoroosevelt/oauth2-govbr library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
brenoroosevelt / oauth2-govbr example snippets
use BrenoRoosevelt\OAuth2\Client\GovBr;
$govBr = new GovBr([
'clientId' => 'XXXXXXXX', // Client ID fornecido pelo GovBr
'clientSecret' => 'YYYYYYYY', // Senha fornecida pelo provedor GovBr
'redirectUri' => "https://seu-app-dominio.com.br/seu-login", // Url de redirecionamento
'redirectUriLogout' => "https://seu-app-dominio.com.br/seu-logout"
]);
$urlAutorizacao = $govBr->getAuthorizationUrl();
$state = $this->govBr->getState();
// redirecionar o usuário para a url