Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. public function actionOauthLogin()
  2. {
  3. $query = http_build_query([
  4. 'client_id' => '12',
  5. 'client_secret' => '',
  6. 'redirect_uri' => 'http://client.loc/api/oauth/callback',
  7. 'response_type' => 'code',
  8. 'scope' => '',
  9. ]);
  10. return $this->redirect('http://oauth-server.loc/oauth/authorize?' . $query);
  11. }
  12.  
  13. public function fomIdCallback()
  14. {
  15. $http = new Client();
  16. $response = $http->post('http://oauth-server.loc/oauth/token', [
  17. 'form_params' => [
  18. 'grant_type' => 'authorization_code',
  19. 'client_id' => '3',
  20. 'client_secret' => 'TJDyfygkuga45rtyfj8&65567Yhhgjjjj',
  21. 'redirect_uri' => 'http://client.loc/api/oauth/callback',
  22. 'code' => Yii::app()->request->getParamFromRequest('code'),
  23. ],
  24. ]);
  25. return json_decode((string) $response->getBody(), true);
  26. }
  27.  
  28. {"error":"invalid_client","message":"Client authentication failed"}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement