Why is my Authorization Header giving me a 401 in Guzzle?

后端 未结 2 1551
栀梦
栀梦 2021-01-20 06:46

I am getting a 401 on Guzzle 4.2 and the same setup works on Postman. Code below.

// Create a client with a base URL
    $client = new GuzzleHttp\\Client([\'         


        
2条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-20 07:40

    $response = $client->get('GET', 'cloud.feedly.com/v3/streams/contents?streamId=user/user-id/category/global.all&count=1', ['auth' =>  ['YOUR_USERNAME', 'YOUR_PASSWORD']]);
    

    The 401 error means you should authenticate yourself with a valid username and password

    Regards

提交回复
热议问题