duocircle/remoteauth-socialite-provider

RemoteAuth OAuth2 Provider for Laravel Socialite

1.0.2 2019-02-11 05:52 UTC

This package is auto-updated.

Last update: 2024-03-08 07:56:11 UTC


README

Laravel Socialite provider for RemoteAuth

Installation

1. Composer

Add package to your laravel project via composer

composer require owenconti/remoteauth-socialite-provider

2. Add the Event and Listeners

  • Add SocialiteProviders\Manager\SocialiteWasCalled event to your listen[] array in <app_name>/Providers/EventServiceProvider.

  • Add listener '\SocialiteProviders\RemoteAuth\RemoteAuthExtendSocialite@handle' to the SocialiteProviders\Manager\SocialiteWasCalled[].

For example:

    protected $listen = [
        ...
        \SocialiteProviders\Manager\SocialiteWasCalled::class  => [
            ...
            '\SocialiteProviders\RemoteAuth\RemoteAuthExtendSocialite@handle',
        ],
    ];

4. Environment Variables

Append provider values to your .env file (you can find them in the RemoteAuth Applicaton Dashboard):

REMOTEAUTH_CLIENT_ID=your_client_id
REMOTEAUTH_CLIENT_SECRET=your_client_secret

5. Add Configuration Variables

Append the following configuration values to config/services.php:

    'remoteauth' => [
        'client_id' => env('REMOTEAUTH_CLIENT_ID'),
        'client_secret' => env('REMOTEAUTH_CLIENT_SECRET'),
        'redirect' => config('app.url') . '/callback'
    ]

6. Use Test Server

If you are working in a non-production environment, we recommend you use the RemoteAuth sandbox server: https://sandbox.remoteauth.com. You can point the Socialite Provider at the sandbox server via:

// .env
REMOTEAUTH_URL=https://sandbox.remoteauth.com
// config/services.php
    'remoteauth' => [
        'url' => env('REMOTEAUTH_URL')
    ]