Skip to content

Commit 34aea46

Browse files
committed
Merge pull request #57 from copynpaste/fix-duplicate-token-add
fixed duplicate adding of access_token to request url on local server
2 parents f75a615 + 39f6bf7 commit 34aea46

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/OAuth2Demo/Client/Controllers/RequestResource.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,16 @@ public function requestResource(Application $app)
2121
// pull the token from the request
2222
$token = $app['request']->get('token');
2323

24-
// make the resource request with the token in the request body
25-
$config['resource_params']['access_token'] = $token;
26-
2724
// determine the resource endpoint to call based on our config (do this somewhere else?)
2825
$apiRoute = $config['resource_route'];
29-
$endpoint = 0 === strpos($apiRoute, 'http') ? $apiRoute : $urlgen->generate($apiRoute, $config['resource_params'], true);
26+
$endpoint = 0 === strpos($apiRoute, 'http') ? $apiRoute : $urlgen->generate($apiRoute, array(), true);
3027

3128
// make the resource request and decode the json response
3229
$request = $http->get($endpoint, null, $config['http_options']);
3330
$request->getQuery()->set('access_token', $token);
3431
$response = $request->send();
3532
$json = json_decode((string) $response->getBody(), true);
3633

37-
$resource_uri = sprintf('%s%saccess_token=%s', $endpoint, false === strpos($endpoint, '?') ? '?' : '&', $token);
38-
39-
return $twig->render('client/show_resource.twig', array('response' => $json ? $json : $response, 'resource_uri' => $resource_uri));
34+
return $twig->render('client/show_resource.twig', array('response' => $json ? $json : $response, 'resource_uri' => $request->getUrl()));
4035
}
4136
}

0 commit comments

Comments
 (0)