I'm trying to pass an auth token as a header but the token is not being registered, therefore I am being blocked from my request.
1) Make initial request for auth token:
$response = $this->call('POST', 'oauth/access_token', [
//data to get auth token
]);
//valid token
$access_token = json_decode($response->content())->access_token;
2) Make request for data, using the auth token as a header. Reading this message chain on this topic, I thought that this was the way to do it:
$activities = $this->call('GET', '1.0/stuff', [],
[
Request::header('Authorization') => $access_token
]
);
3) Print out the result:
die($activities);
Command line response: {"error":"forbidden","error_description":"Access denied.","error_data":null}
What is the correct way to pass headers in Laravel-5 phpunit testing?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire