yii2 oauth2

Solutions on MaxInterview for yii2 oauth2 by the best coders in the world

showing results for - "yii2 oauth2"
Lettie
09 Jan 2020
1use yii\authclient\OAuth2;
2
3// assuming class MyAuthClient extends OAuth2
4$oauthClient = new MyAuthClient();
5$url = $oauthClient->buildAuthUrl(); // Build authorization URL
6Yii::$app->getResponse()->redirect($url); // Redirect to authorization URL.
7// After user returns at our site:
8$code = Yii::$app->getRequest()->get('code');
9$accessToken = $oauthClient->fetchAccessToken($code); // Get access token
10