PHP code example of successgo / success-auth
1. Go to this page and download the library: Download successgo/success-auth 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/ */
successgo / success-auth example snippets
// build config
$config = \SuccessGo\SuccessAuth\Config\AuthConfigBuilder::builder()
->clientId('Client Id')
->clientSecret('Client Secret')
->redirectUri('Redirect Uri')
->build();
// build the auth request
$authRequest = new \SuccessGo\SuccessAuth\Request\AuthRequest\WechatOpenAuthRequest($config, new \SuccessGo\SuccessAuth\Config\AuthSource\WechatOpenAuthSource());
// build auth callback
$authCallback = \SuccessGo\SuccessAuth\Model\AuthCallbackBuilder::builder()->code('Code')->build();
// get the auth response
$authResponse = $authRequest->login($authCallback);
if ($authResponse->isOk()) {
// Do your business here
}