Skip to content

OAuth token request returns HTTP/1.1 401 Unauthorized #3185

@OLTC-fperrin

Description

@OLTC-fperrin

Hello,

I was trying to setup a OAuth integration but I can't seem to get past this problem :/
I was following a book's tutorial with sources for the mini-OAuth client from this repository:

https://github.com/ajzele/B05032-BookAppOauthClient

I then tried using the OAuth client from this repository instead:

https://gist.github.com/anupdugar/2870f28a5c108cc43df9

Whatever I do I get the following error:

Fatal error: Uncaught exception 'OAuth\Common\Http\Exception\TokenResponseException'
with message 'file_get_contents(http://magento2.local/oauth/token/request): failed to open
stream: HTTP request failed! HTTP/1.1 401 Unauthorized ' in
/var/www/magento2/vendor/lusitanian/oauth/src/OAuth/Common/Http/Client/StreamClient.php:73
Stack trace: #0 
var/www/magento2/vendor/lusitanian/oauth/src/OAuth/OAuth1/Service/AbstractService.php(52):
OAuth\Common\Http\Client\StreamClient->retrieveResponse(Object(OAuth\Common\Http\Uri\Uri),
Array, Array) #1 /var/www/magento2/authInterface/checklogin.php(19):
OAuth\OAuth1\Service\AbstractService->requestRequestToken() #2 {main} thrown in
/var/www/magento2/vendor/lusitanian/oauth/src/OAuth/Common/Http/Client/StreamClient.php on line 73

From what I gather from googling it, it might have something to do with the fact that I'm not using HTTPS for the tests ?

Any help would be appreciated

Thanks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions