joshcanhelp / wp-rest-api-auth0

Authorize WP REST API calls with access tokens from Auth0
MIT License
5 stars 1 forks source link

PHP Warning: Undefined array key "REDIRECT_HTTP_AUTHORIZATION" #18

Open ludovicsclain opened 11 months ago

ludovicsclain commented 11 months ago

Hey Josh 👋  Hope you're doing well. Just to let you know that with your latest version I get tons of warnings with the same comments:

PHP Warning:  Undefined array key "REDIRECT_HTTP_AUTHORIZATION" in ~/wp-content/plugins/wp-rest-api-auth0-main/src/wp-rest-api-auth0.php on line 43

Hope this helps you debug. Take care!

joshcanhelp commented 11 months ago

@ludovicsclain - I made a change that should solve this. Can you replace your src/wp-rest-api-auth0.php file with this one?

https://github.com/joshcanhelp/wp-rest-api-auth0/blob/07071383120d5c1ee11580330ed7a071758453bc/src/wp-rest-api-auth0.php

Let me know if that works and I'll put out a proper release.

ludovicsclain commented 10 months ago

Hey Josh 👋  first of all I wish you all my best wishes for health and prosperity for this new year 2024 🎉 

I am taking advantage of the calm at the start of the year to return to conversations like this, and I have actually tested the new version of the code, and it is not conclusive.

Whereas with the penultimate version everything was going well (for example I could publish an article via API) but I had this error [04-Jan-2024 14:45:14 UTC] PHP Warning: Undefined array key "scope" in ~/wp-content/plugins/wp-rest-api-auth0-main/src/wp-rest-api-auth0.php on line 119, with the latest version I can no longer publish and I have this in my logs [04-Jan-2024 14:33:29 UTC] WP REST API Auth0: No access token found in the request with of course API response "You do not have authorization to publish… error 401".

Hope it helps! Warm regards, Ludovic