PHP code example of delboy1978uk / bone-social-auth

1. Go to this page and download the library: Download delboy1978uk/bone-social-auth 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/ */

    

delboy1978uk / bone-social-auth example snippets




// use statements here
use Bone\SocialAuth\SocialAuthPackage;

return [
    'packages' => [
        // packages here...,
        SocialAuthPackage::class,
    ],
    // ...
];

return [
    'bone-social-auth' => [
        'callback' => 'https://awesome.scot/user/login/via',
        'providers' => [
            'X' => [
                'enabled' => true,
                'keys' => [
                    'id' => '...',
                    'secret' => '...',
                ]
            ],
            'Google' => [
                'enabled' => true,
                'keys' => [
                    'id' => '...',
                    'secret' => '...',
                ]
            ],
            'Github' => [
                'enabled' => true,
                'keys' => [
                    'id' => '...',
                    'secret' => '...',
                ]
            ],
            'Facebook' => [
                'enabled' => true,
                'keys' => [
                    'key' => '...',
                    'secret' => '...',
                ]
            ],
        ],
         'custom' => [
             // use this config to auth with your own Bone FrameworkOAuth2 server
            'providers' => [
                'Boneframework' => [
                    'adapter' => \Bone\SocialAuth\Provider\BoneFrameworkProvider::class,
                    'enabled' => true,
                    'keys' => [
                        'id' => '32815de2c0a25d239ff0585674c938a9',
                        'secret' => 'JDJ5JDEyJC9iT3hXVjRCeTdJL2ZPSlZOd2xFRnVPZ09KNW9GL2RDV2I0dTcwdUNnNWpHcGt2SXQzdWJL',
                    ],
                    'icon' => 'bone',
                    'color' => 'black'
                ],
            ],
        ],
    ],
];

return [
    'views' => [
        'boneuser' => 'src/App/View/BoneUser',
    ],
];

<?= $this->socialAuth() 

    protected $scope = 'basic';
    protected $apiBaseUrl = 'https://boneframework.docker/api';
    protected $authorizeUrl = 'https://boneframework.docker/oauth2/authorize';
    protected $accessTokenUrl = 'https://boneframework.docker/oauth2/token';
    protected $callback = 'https://boneframework.docker/oauth2/token';