turbofeedorglory/socialiteprovider-eveonline

Eve Online OAuth2 Provider for Laravel Socialite

v1.0 2021-06-13 12:08 UTC

This package is not auto-updated.

Last update: 2024-10-01 01:08:42 UTC


README

composer require turbofeedorglory/socialiteprovider-eveonline

安装与基本使用

请参阅基础安装指南,然后按照以下特定提供商的说明进行操作。

添加.env变量

EVEONLINE_CLIENT_ID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

EVEONLINE_CLIENT_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

EVEONLINE_REDIRECT_URI=https://:8000/eveonline/login

EVEONLINE_SCOPES=publicData esi-alliances.read_contacts.v1 esi-clones.read_clones.v1

将配置添加到config/services.php

'eveonline' => [    
  'client_id' => env('EVEONLINE_CLIENT_ID'),  
  'client_secret' => env('EVEONLINE_CLIENT_SECRET'),  
  'redirect' => env('EVEONLINE_REDIRECT_URI'),
  'scopes' => env('EVEONLINE_SCOPES') 
],

添加提供者事件监听器

配置包的监听器以监听SocialiteWasCalled事件。

将事件添加到您的app/Providers/EventServiceProvider中的listen[]数组。有关详细说明,请参阅基础安装指南

protected $listen = [
    \SocialiteProviders\Manager\SocialiteWasCalled::class => [
        // ... other providers
        'SocialiteProviders\\EveOnline\\EveOnlineExtendSocialite@handle',
    ],
];

使用方法

现在您应该可以使用提供商,就像您通常使用Socialite一样(假设您已安装了外观)

return Socialite::driver('eveonline')->redirect();

返回的用户字段

  • `id`
  • `name`
  • `owner_hash`
  • `token`
  • `expiresIn`
  • `refreshToken`