Answers for "yii2 OAuth2"

PHP
0

yii2 OAuth2

use yii\authclient\OAuth2;

// assuming class MyAuthClient extends OAuth2
$oauthClient = new MyAuthClient();
$url = $oauthClient->buildAuthUrl(); // Build authorization URL
Yii::$app->getResponse()->redirect($url); // Redirect to authorization URL.
// After user returns at our site:
$code = Yii::$app->getRequest()->get('code');
$accessToken = $oauthClient->fetchAccessToken($code); // Get access token
Posted by: Guest on September-07-2020

Browse Popular Code Answers by Language