dejc/passport-socialite 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

dejc/passport-socialite

Composer 安装命令:

composer require dejc/passport-socialite

包简介

A socialite driver for Passport

README 文档

README

Packagist License Latest Stable Version Build Status

A Laravel Socialite driver for authenticating with Laravel Passport OAuth servers.

Installation

This package can be installed using Composer. The Socialite package will also be installed if it is not already installed.

composer require matt-allan/passport-socialite

Configuration

Before using this driver, you will need to add credentials for the Passport server. These credentials should be placed in your config/services.php configuration file, and should use the key passport. For example:

'passport' => [
    'client_id' => env('PASSPORT_CLIENT_ID'),
    'client_secret' => env('PASSPORT_CLIENT_SECRET'),
    'url' => env('PASSPORT_URL'),
    'redirect' => env('PASSPORT_REDIRECT'),
],

Usage

The Passport driver works identically to the other Socialite drivers. All of the methods mentioned in the official documentation are available.

You can access the passport driver using the Socialite facade:

<?php

namespace App\Http\Controllers\Auth;

use Socialite;

class LoginController extends Controller
{
    /**
     * Redirect the user to the Passport server's authentication page.
     *
     * @return \Illuminate\Http\Response
     */
    public function redirectToProvider()
    {
        return Socialite::driver('passport')->redirect();
    }

    /**
     * Obtain the user information from the Passport server.
     *
     * @return \Illuminate\Http\Response
     */
    public function handleProviderCallback()
    {
        $user = Socialite::driver('passport')->user();

        // $user->token;
    }
}

The current user's details will be retrieved from the default api/user route.

In addition to the standard Socialite methods a refresh method is available to easily refresh expired tokens. The refresh method accepts a refresh token and returns an updated User with new access and refresh tokens if the token is refreshed successfully.

$user = Socialite::driver('passport')->refresh($refreshToken);

Change log

Please see CHANGELOG for more information on what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-12-20

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固