FOSOAuthServerBundle を使用しようとしています。それはかなりうまく機能しますが、APIで機能させようとしています...新しいユーザーを登録するときに、新しいクライアントを作成し、彼に直接承認を与えたいと思います。access_token のリクエストは、ユーザーがログインするときに行われます...
問題、ドキュメントに記載されている例では、承認ページへのリダイレクトが行われ、その後 URL にリダイレクトされます...リダイレクトなしで、承認を行うためだけに素晴らしいでしょう...
私の登録コードの一部:
$user->setUsername($name);
$user->setEmail($email);
$encoder = $this->get('security.encoder_factory')->getEncoder($user);
$password_user = $encoder->encodePassword($password, $user->getSalt());
$user->setPassword($password_user);
$clientManager = $this->get('fos_oauth_server.client_manager.default');
$client = $clientManager->createClient();
$client->setRedirectUris(array('http://localhost:8888/app_dev.php'));
$client->setAllowedGrantTypes(array('token', 'authorization_code'));
$clientManager->updateClient($client);
$user->setClient($client);
// Here we would like to authorize the user witout redirection :
return $this->redirect($this->generateUrl('fos_oauth_server_authorize', array(
'client_id' => $client->getPublicId(),
'redirect_uri' => 'http://localhost:8888/app_dev.php',
'response_type' => 'code'
)));
リダイレクトなしで承認したい... API :/ にあるため、URLがないため... 承認する別の方法はありますか?
ありがとう