PHP code example of olivmai / linkvalue-oauth2-bundle

1. Go to this page and download the library: Download olivmai/linkvalue-oauth2-bundle 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/ */

    

olivmai / linkvalue-oauth2-bundle example snippets


# config/bundles.php
return [
    /* ... */
    Olivmai\LinkvalueOAuth2Bundle\LinkvalueOAuth2Bundle::class => ['all' => true],
];



namespace App\Controller;

use Olivmai\LinkvalueOAuth2Bundle\Provider\LinkvalueProvider;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Routing\Annotation\Route;

class LinkvalueController extends AbstractController
{
    /**
     * Link to this controller to start the "connect" process
     *
     * @Route("/connect/linkvalue", name="connect_linkvalue_start")
     * @param LinkvalueProvider $linkvalueProvider
     * @return RedirectResponse
     */
    public function connectAction(LinkvalueProvider $linkvalueProvider): RedirectResponse
    {
        // redirect to LV Connect and then back to connect_linkvalue_check, see below
        return $linkvalueProvider->redirect();
    }

    /**
     * @Route("/connect/linkvalue/check", name="connect_linkvalue_check")
     * @param Request $request
     * @param LinkvalueProvider $linkvalueProvider
     */
    public function connectCheckAction(Request $request, LinkvalueProvider $linkvalueProvider)
    {
        // leave this method blank to authenticate through Guard authenticator
    }
}


LinkvalueUser :
  -id: "xxxxx"                 // string
  -firstName: "xxxxx"           // string
  -lastName: "XXXXX"           // string
  -email: "[email protected]"     // string
  -profilePictureUrl: "xxxxxx"  // string (url to profile picture)
  -tags: []                    // array
  -roles: []                   // array
  -createdAt: DateTime         // DateTime
  -city: null                  // string|null
  -job: null                   // string|null
}