Hey there. I've got EXACTLY the same problem.
By any chance, did you find a solution in the meantime that could be usefull ?
Thanks !
Summer Sale! All accounts are 50% off this week.
Hey guys , So i have 2 web apps talking and im trying to get a list of blog post from one to another. I have set up passport and I seem to be getting keys accepted etc but my
echo $response->getBody();
Just gives me the app login page
My Guzzle call looks like this
$response = $client->post('http://138.68.180.100/oauth/token', [
'form_params' => [
'client_id' => 2,
// The secret generated when you ran: php artisan passport:install
'client_secret' => 'secret',
'grant_type' => 'password',
'username' => '[email protected]',
'password' => 'secret',
'scope' => '*',
]
]);
// You'd typically save this payload in the session
$auth = json_decode((string)$response->getBody());
$response = $client->get('http://138.68.180.100/news/articles', [
'headers' > [
'Authorization' => 'Bearer ' . $auth->access_token,
'Accept' => 'application/json'
]
]);
echo $response->getBody();
die();
On the other app side I have a route
Route::get('news/articles', 'ApiController@hello')->middleware('auth:api');
A controller method
public function hello() {
$articles = new Articles();
$articles = $articles->get();
return $articles;
}
and I also updated my .htaccess
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]
Any ideas would be greatly appricated
Please or to participate in this conversation.