fastly / fastly-php

A Fastly API client for PHP
https://packagist.org/packages/fastly/fastly
MIT License
24 stars 34 forks source link

UserApi calls relying on getCurrentUserRequest fail to authenticate #37

Closed gggeek closed 1 year ago

gggeek commented 2 years ago

Version

1.0.0-alpha1

What happened

trying to make a call to UserApi::getCurrentUser, having passed in a Configuration option with an API Token. I get an error 401 Unauthorized. This seems to be due to the code in UserApi::getCurrentUserRequest not adding to the request the auth token. It works as soon as I add that snippet back (or when I do a curl request to /current_user passing in the Fastly-Key token)

gggeek commented 2 years ago

PS: I do not know how this fits in with API classes being auto-generated, so i will refrain from trying to post a PR with a fix. Maybe there are docs somewhere which need to be fixed, which will drive the correct code to be generated? I also find it surprising to see in the code so very few places were the auth token from config is taken into account and transformed into a corresponding http header...

Integralist commented 1 year ago

Closing this issue now we've published v1.0.0 https://packagist.org/packages/fastly/fastly