Yii2 Oauth2

[Solved] Yii2 Oauth2 | Php Frameworks Yii - Code Explorer | yomemimo.com
Question : yii2 OAuth2

Answered by : aylmer-dela-cruz

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

Source : https://www.yiiframework.com/extension/yiisoft/yii2-authclient/doc/api/2.2/yii-authclient-oauth2 | Last Update : Mon, 14 Sep 20

Answers related to yii2 oauth2

Code Explorer Popular Question For Php Frameworks Yii