承接 socialiteproviders/usos 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

socialiteproviders/usos

最新稳定版本:5.0.0

Composer 安装命令:

composer require socialiteproviders/usos

包简介

USOS OAuth1 Provider for Laravel Socialite

README 文档

README

composer require socialiteproviders/usos

Installation & Basic Usage

Please see the Base Installation Guide, then follow the provider specific instructions below.

Add configuration to config/services.php

'usos' => [
  'domain' => env('USOS_DOMAIN_URL'), // Because of every instance of USOS is self-hosted
  'client_id' => env('USOS_CLIENT_ID'),
  'client_secret' => env('USOS_CLIENT_SECRET'),
  'redirect' => env('USOS_REDIRECT_URI')
],

As a default, provider loads only necessary for Socialite data. If you need to get more data during authentication process, such as student status or phone number, you may add profile_fields_selector parameter:

'usos' => [
  // ...
  'profile_fields_selector' => env('USOS_PROFILE_FIELDS_SELECTOR'),
  // ...
]

Some fields may be not available without scopes field specifying.

Add provider event listener

Laravel 11+

In Laravel 11, the default EventServiceProvider provider was removed. Instead, add the listener using the listen method on the Event facade, in your AppServiceProvider boot method.

  • Note: You do not need to add anything for the built-in socialite providers unless you override them with your own providers.
Event::listen(function (\SocialiteProviders\Manager\SocialiteWasCalled $event) {
    $event->extendSocialite('usos', \SocialiteProviders\Usos\Provider::class);
});
Laravel 10 or below Configure the package's listener to listen for `SocialiteWasCalled` events.

Add the event to your listen[] array in app/Providers/EventServiceProvider. See the Base Installation Guide for detailed instructions.

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

Usage

You should now be able to use the provider like you would regularly use Socialite (assuming you have the facade installed):

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

You also can use USOS scopes via Socialite scopes method:

return Socialite::driver('usos')
    ->scopes(['personal', 'email'])
    ->redirect();

To get more information about scopes you may visit a documentation page at yours USOS instance, or at the USOSapi Mother server webpage.

统计信息

  • 总下载量: 281
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-03-02