定制 crowdedlight/izettle-socialite 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

crowdedlight/izettle-socialite

Composer 安装命令:

composer require crowdedlight/izettle-socialite

包简介

IZettle OAuth2 Provider for Laravel Socialite

README 文档

README

Installation and config

Install Larvel Socialite (see here: https://github.com/laravel/socialite/blob/2.0/readme.md)

Install the IZettle socialite provider

composer require crowdedlight/izettle-socialite

Add the follwing to your .env file:

IZETTLE_CLIENT_ID=
IZETTLE_CLIENT_SECRET=
IZETTLE_USERNAME=
IZETTLE_PASSWORD=
IZETTLE_REDIRECT=

Password Grant

Using the password grant method for private integrations with IZettle be sure to also fill out the IZETTLE_USERNAME and IZETTLE_PASSWORD fields in .env file. IZETTLE_REDIRECT isn't used for password grant.

To use it with password grant just use the following method as it only requires a single interaction with the api. Remember to use Stateless as the api doesn't use a state for this interaction.

    /**
     * Gets the users AccessToken and Refreshtoken from the api.
     *
     *
     */
    public function AuthIzettle()
    {
        $user = Socialite::driver('izettle')->stateless()->user();
        //dd($user);
    }

Laravel <= 5.4

Add the following to your config/app.php

crowdedlight\Socialite\IZettle\IZettleServiceProvider::class,

Laravel 5.5

Service Provider is auto discovered.

Usage

<?php

namespace App\Http\Controllers\Auth;

use Socialite;

class AuthController extends Controller
{
    /**
     * Redirect the user to the IZettle authentication page.
     *
     * @return Response
     */
    public function redirectToProvider()
    {
        return Socialite::driver('izettle')->redirect();
    }

    /**
     * Obtain the user information from IZettle.
     *
     * @return Response
     */
    public function handleProviderCallback()
    {
        $user = Socialite::driver('izettle')->user();

        //dd($user);
    }
}

Retrieving User Details

Once you have a user instance, you can grab a few more details about the user:

$user = Socialite::driver('izettle')->user();

$token = $user->token;
$expiresIn = $user->expiresIn;
$user->getId();
$user->organization;

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-08-23

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固