steelze/google-one-tap 问题修复 & 功能扩展

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

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

steelze/google-one-tap

最新稳定版本:v0.2.0-beta

Composer 安装命令:

composer require steelze/google-one-tap

包简介

Google One Tap Login For Laravel

README 文档

README

Latest Version on Packagist Total Downloads GitHub Actions

This package integrates Google's one tap login into a laravel project.

Installation

You can install the package via composer:

composer require steelze/google-one-tap

The service provider will automatically be registered.

Next, you must publish the config file:

php artisan vendor:publish --tag=google-one-tap

This is the contents of the default configuration file. Here you can modify configurations .

return [

    /*
    |--------------------------------------------------------------------------
    | Google Client ID
    |--------------------------------------------------------------------------
    |
    | This value is your Google app's client ID, which is found
    | and created in the Google Developers Console.
    |
    */

    'client_id' => env('GOOGLE_CLIENT_ID'),

    /*
    |--------------------------------------------------------------------------
    | Enable Google One Tap
    |--------------------------------------------------------------------------
    |
    | This determines whether to display One tap or not. The default value is
    | true. Google One tap will not be displayed when this value is false
    |
    */

    'enable' => (bool) env('ENABLE_GOOGLE_ONE_TAP', true),

    /*
    |--------------------------------------------------------------------------
    | Login URI
    |--------------------------------------------------------------------------
    |
    | This specifies the the URI of your login endpoint. The ID token credential
    | response is posted to this endpoint when no callback function is defined
    | and a user clicks on the One Tap buttons, or automatic sign takes place.
    |
    */

    'login_uri' => '',

    /*
    |--------------------------------------------------------------------------
    | Cancel on Outside Click
    |--------------------------------------------------------------------------
    |
    | This attribute sets whether or not to cancel the One Tap request if the
    | user clicks outside of the prompt. The default value is true. To disable it,
    | set the value to false.
    |
    */

    'cancel_on_tap_outside' => false,

    /*
    |--------------------------------------------------------------------------
    | Context
    |--------------------------------------------------------------------------
    |
    | Changes the text of the title and messages shown in the One Tap prompt
    | Supported: "use", "signin", "signup"
    |
    */

    'context' => 'use',

    /*
    |--------------------------------------------------------------------------
    | itp_support
    |--------------------------------------------------------------------------
    |
    | This field determines if the upgraded One Tap UX should be enabled on
    | browsers that support Intelligent Tracking Prevention (ITP).
    | The default value is false. See the following for further
    | information: https://developers.google.com/identity/gsi/web/guides/features#upgraded_ux_on_itp_browsers
    |
    */

    'itp_support' => false,

    /*
    |--------------------------------------------------------------------------
    | Custom Attributes
    |--------------------------------------------------------------------------
    |
    | Custom data attributes, which are sent to your login endpoint with the
    | ID token retrieved from Google.
    |
    */
    'custom' => [

    ]
];

Usage

Update the login uri in the config file. The specified uri will be called by google and the credential is posted to this endpoint

// config/google-one-tap.php
/*
|--------------------------------------------------------------------------
| Login URI
|--------------------------------------------------------------------------
|
| This specifies the the URI of your login endpoint. The ID token credential
| response is posted to this endpoint when no callback function is defined
| and a user clicks on the One Tap buttons, or automatic sign takes place.
|
*/

'login_uri' => '',

Within the route callback handler, call the GoogleOneTapFacade::getUserFromProvider() method. This method will return an array of the logged in user details or throw an exception if an error occured.

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email sogungbure@gmail.com instead of using the issue tracker.

Credits

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-07-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固