PHP code example of socialiteproviders / tiktokshop

1. Go to this page and download the library: Download socialiteproviders/tiktokshop library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

socialiteproviders / tiktokshop example snippets


'tiktokshop' => [
    'client_id'      => env('TIKTOKSHOP_APP_KEY'),       // Your Partner Center App Key
    'client_secret'  => env('TIKTOKSHOP_APP_SECRET'),    // Your Partner Center App Secret
    'redirect'       => env('TIKTOKSHOP_REDIRECT_URI'),  // Your callback URI
],

use SocialiteProviders\Manager\SocialiteWasCalled;
use App\Providers\Socialite\TikTokShop\TikTokShopExtendSocialite;
use Illuminate\Support\Facades\Event;

public function boot()
{
    Event::listen(function (SocialiteProviders\Manager\SocialiteWasCalled $event) {
        $event->extendSocialite('tiktokshop', \App\Providers\Socialite\TikTokShop\Provider::class);
    });
}

protected $listen = [
    \SocialiteProviders\Manager\SocialiteWasCalled::class => [
        \App\Providers\Socialite\TikTokShop\TikTokShopExtendSocialite::class.'@handle',
    ],
];

use Laravel\Socialite\Facades\Socialite;

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

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

// Access mapped fields:
$shopUser->getId();
$shopUser->getName();
$shopUser->token;
$shopUser->refreshToken;
$shopUser->expiresIn;