delboy1978uk/bone-social-auth

SocialAuth package for Bone Framework

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

This package is auto-updated.

Last update: 2024-11-30 01:50:59 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' => [
            'Twitter' => [
                'enabled' => false,
                'keys' => [
                    'id' => '...',
                    'secret' => '...',
                ]
            ],
            'Google' => [
                'enabled' => true,
                'keys' => [
                    'id' => '...',
                    'secret' => '...',
                ]
            ],
            'Github' => [
                'enabled' => true,
                'keys' => [
                    'id' => '...',
                    'secret' => '...',
                ]
            ],
            'Facebook' => [
                'enabled' => true,
                'keys' => [
                    'key' => '...',
                    'secret' => '...',
                ]
            ],
        ]
    ],
];

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.