Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function actionOauthLogin()
- {
- $query = http_build_query([
- 'client_id' => '12',
- 'client_secret' => '',
- 'redirect_uri' => 'http://client.loc/api/oauth/callback',
- 'response_type' => 'code',
- 'scope' => '',
- ]);
- return $this->redirect('http://oauth-server.loc/oauth/authorize?' . $query);
- }
- public function actionOauthCallback()
- {
- $http = new Client();
- $response = $http->post('http://oauth-server.loc/oauth/token', [
- 'form_params' => [
- 'grant_type' => 'authorization_code',
- 'client_id' => '3',
- 'client_secret' => 'TJDyfygkuga45rtyfj8&65567Yhhgjjjj',
- 'redirect_uri' => 'http://client.loc/api/oauth/callback',
- 'code' => Yii::app()->request->getParamFromRequest('code'),
- ],
- ]);
- return json_decode((string) $response->getBody(), true);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement