2017 © Pedro Peláez
 

library izettle-socialite

IZettle OAuth2 Provider for Laravel Socialite

image

crowdedlight/izettle-socialite

IZettle OAuth2 Provider for Laravel Socialite

  • Friday, August 25, 2017
  • by crowdedlight
  • Repository
  • 1 Watchers
  • 0 Stars
  • 9 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

IZettle Provider for Laravel Socialite

Installation and config

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

Install the IZettle socialite provider, (*2)

composer require crowdedlight/izettle-socialite

Add the follwing to your .env file:, (*3)

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., (*4)

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., (*5)

    /**
     * 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, (*6)

crowdedlight\Socialite\IZettle\IZettleServiceProvider::class,

Laravel 5.5

Service Provider is auto discovered., (*7)

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:, (*8)

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

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

The Versions

25/08 2017

dev-master

9999999-dev

IZettle OAuth2 Provider for Laravel Socialite

  Sources   Download

MIT

The Requires

 

by Frederik Mazur Andersen

25/08 2017

v0.1

0.1.0.0

IZettle OAuth2 Provider for Laravel Socialite

  Sources   Download

MIT

The Requires

 

by Frederik Mazur Andersen