delboy1978uk/bone-social-auth

SocialAuth package for Bone Framework

Installs: 22

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 1

pkg:composer/delboy1978uk/bone-social-auth

v1.1.3 2022-11-03 22:57 UTC

This package is auto-updated.

Last update: 2025-10-21 17:57:44 UTC


README

Latest Stable Version build status Code Coverage Scrutinizer Code Quality License

SocialAuth package for Bone Framework using HybridAuth

installation

Use Composer

composer require delboy1978uk/bone-social-auth

Simply add to the config/packages.php after the Bone User Package

<?php

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

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

settings

Create a settings file in the config/ folder called bone-social-auth.php:

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'
                ],
            ],
        ],
    ],
];

usage

You will probably want to have the social links on your /user/login link, so copy the View files from vendor/delboy1978uk/bone-user/View/BoneUser to the main App view src/View/BoneUser and add the followimg config to config/views.php in order to override them:

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

In any view file, and if overriding bone-user then particularly src/App/View/BoneUser/login.php, you can call

<?= $this->socialAuth() ?>

which will display some links to log you in. Once logged in you will have a standard bone-user.

auth via a Bone Framework OAuth Server

Use the custom config above, you can extend Bone\SocialAuth\Provider\BoneFrameworkProvider and define the following :

    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';