laravelevetools/eve-socialite-provider

Implements eve's SSO authentication.

1.0 2022-02-13 06:32 UTC

This package is auto-updated.

Last update: 2022-05-13 07:19:03 UTC


README

Dedicated Socialite provider for laravel based on SeAT's service eveseat/services/socialite
Just without all the other SeAT stuff.

Installation

Install the composer package. Laravel will automatically call the service provider.

composer require laravelevetools/eve-socialite-provider

You will need to get application and client key from Eve's Devloper Portal
You can store the values in your .env file.

Make sure you register the client_id, secret and callback url in config/services.php

    'eveonline' => [
        'client_id'    => env('EVE_CLIENT_ID'),
        'client_secret' => env('EVE_CLIENT_SECRET'),
        'redirect'      => env('EVE_CALLBACK_URL')
    ]

Usage

In your controller you will need two functions. A redirect, and a callback function. make sure in your routes, you define the same callback route as in the developer portal.

use App\Http\Controllers\Controller;
use Laravel\Socialite\Contracts\Factory as Socialite;

class TestLoginController extends Controller
{
    const scopes = []; //define your scopes here
    
    public function redirect(Socialite $social){

        return $social->driver('eveonline')
            ->scopes(self::scopes)
            ->redirect();
    }

    public function callback(Socialite $social){
        
        $eve_data = $social->driver('eveonline')
            ->scopes(self::scopes)
            ->user();

       // Continue with User authentication as you see fit.
    }
}