1. Go to this page and download the library: Download ikerib/giltza-oauth2 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/ */
ikerib / giltza-oauth2 example snippets
public function authenticate(Request $request): Passport
{
$client = $this->clientRegistry->getClient('giltza');
$accessToken = $this->fetchAccessToken($client);
return new SelfValidatingPassport(
new UserBadge($accessToken->getToken(), function() use ($accessToken, $client) {
$user = $client->fetchUserFromToken($accessToken);
// 1) have they logged in with Facebook before? Easy!
$user = $this->entityManager->getRepository(User::class)->findOneBy(['NA' => $user->getId()]);
if ($user) {
return $user;
}
throw new UserNotFoundException();
})
);
}
#[Route(path: '/login/giltza/connect', name: 'oauth_connect')]
public function connect(ClientRegistry $clientRegistry): \Symfony\Component\HttpFoundation\RedirectResponse
{
return $clientRegistry->getClient('giltza')->redirect(['urn:izenpe:identity:global urn:izenpe:fea:properties urn:safelayer:eidas:authn_details']);
}
#[Route(path: '/login/giltza/connect/check', name: 'oauth_check')]
public function check(Request $request, ClientRegistry $clientRegistry): void
{
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.