定制 serenity_technologies/socialite-ctrader 二次开发

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

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

serenity_technologies/socialite-ctrader

Composer 安装命令:

composer require serenity_technologies/socialite-ctrader

包简介

cTrader Socialite Provider for Laravel Socialite.

README 文档

README

This is a cTrader Socialite provider for Laravel Socialite.

Installation

You can install the package via composer:

composer require serenity-technologies/socialite-ctrader

Configuration

Add the configuration to your config/services.php file:

'ctrader' => [
    'client_id' => env('CTRADER_CLIENT_ID'),
    'client_secret' => env('CTRADER_CLIENT_SECRET'),
    'redirect' => env('CTRADER_REDIRECT_URI'),
],

Registration

You will need to register the provider using the SocialiteExtendSocialite event. Add the listener to your app/Providers/EventServiceProvider.php:

protected $listen = [
    \SocialiteProviders\Manager\SocialiteWasCalled::class => [
        \SocialiteProviders\Ctrader\CtraderExtendSocialite::class.'@handle',
    ],
];

Usage

You can now use the provider like any other Socialite provider:

use Laravel\Socialite\Facades\Socialite;

// Redirect to cTrader for authorization
return Socialite::driver('ctrader')->redirect();

// Receive the callback from cTrader
$user = Socialite::driver('ctrader')->user();

// Access user details
$userId = $user->getId();
$email = $user->getEmail(); // Generated as {userId}@ctrader.com
$token = $user->token;

Scopes

By default, the provider uses the accounts scope. You can change this or add more scopes:

return Socialite::driver('ctrader')
    ->scopes(['trading'])
    ->redirect();

User Profile Retrieval

Unlike many other Socialite providers, cTrader does not provide a standard REST endpoint for user profile information. This provider automatically handles this by:

  1. Exchanging the authorization code for an access token via REST.
  2. Connecting to the cTrader Open API gateway via an SSL TCP socket.
  3. Sending a ProtoOAGetCtidProfileByTokenReq message to retrieve the unique cTrader User ID.
  4. Mapping this ID to the Socialite User object and generating a {userId}@ctrader.com email address.

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-06-13

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固