AuthBucket\Bundle\OAuth2Bundle\Tests\TestBundle\Controller\DemoController::grantTypeAuthorizationCodeAction PHP Method

grantTypeAuthorizationCodeAction() public method

public grantTypeAuthorizationCodeAction ( Request $request )
$request Symfony\Component\HttpFoundation\Request
    public function grantTypeAuthorizationCodeAction(Request $request)
    {
        $parameters = ['grant_type' => 'authorization_code', 'code' => $request->query->get('code'), 'redirect_uri' => $request->getUriForPath('/demo/response_type/code'), 'client_id' => 'authorization_code_grant', 'client_secret' => 'uoce8AeP'];
        $server = [];
        $client = new Client($this->get('kernel'));
        $crawler = $client->request('POST', '/api/oauth2/token', $parameters, [], $server);
        $accessTokenResponse = json_decode($client->getResponse()->getContent(), true);
        $accessTokenRequest = get_object_vars($client->getRequest());
        $modelPath = $this->get('router')->generate('demo_resource_type_model', ['access_token' => $accessTokenResponse['access_token']]);
        $debugPath = $this->get('router')->generate('demo_resource_type_debug_endpoint', ['access_token' => $accessTokenResponse['access_token']]);
        $refreshPath = $this->get('router')->generate('demo_grant_type_refresh_token', ['username' => 'authorization_code_grant', 'password' => 'uoce8AeP', 'refresh_token' => $accessTokenResponse['refresh_token']]);
        return $this->render('TestBundle:demo/grant_type:authorization_code.html.twig', ['access_token_response' => $accessTokenResponse, 'access_token_request' => $accessTokenRequest, 'model_path' => $modelPath, 'debug_path' => $debugPath, 'refresh_path' => $refreshPath]);
    }