RyanBayne / TwitchPress

TwitchPress is a system of plugins that combines the power of Twitch.tv with WordPress
http://twitchpress.wordpress.com
GNU General Public License v3.0
12 stars 6 forks source link

Logging hyperactive for Invalid App Token #229

Closed RyanBayne closed 5 years ago

RyanBayne commented 6 years ago

I'm seeing hyperactive logging relating to the expiry and renewal of application tokens.

The Twitch API is providing a new token and the plugin is quickly determining it to be invalid. Is it really doing a check on the new one?

I want to log application changes separately because managing and maintaining the application authorization is primary to everything.

  1. Create an option to disable application logging, enabled by default until we are confident.
  2. Store log in transient with 24 hour expiry and a maximum of 100 entries.
  3. Ensure logging is telling us where and when the app credentials change (which PHP line)
  4. Check the globals - renewal of app token surely must not be affecting an existing global (guess)

[03-Mar-2018 22:22:59 UTC] TwitchPress: check_application_token: Invalid app token [03-Mar-2018 22:23:00 UTC] TwitchPress: request_app_access_token: Access token returned. Requesting function was set_application_credentials + establish_application_token() and the token is v4g1rso4b6ci2qf2e2lsq48dh8kcb5. [03-Mar-2018 22:23:01 UTC] TwitchPress: check_application_token: Invalid app token [03-Mar-2018 22:23:02 UTC] TwitchPress: request_app_access_token: Access token returned. Requesting function was installation + establish_application_token() and the token is lkjokfr2dn5itroy8ei7q5bxihfai3. [03-Mar-2018 22:23:02 UTC] TwitchPress: check_application_token: Invalid app token [03-Mar-2018 22:23:03 UTC] TwitchPress: request_app_access_token: Access token returned. Requesting function was set_application_credentials + establish_application_token() and the token is zrec8skwkizjvqrvkd8oz7egkcsbkx. [03-Mar-2018 22:23:03 UTC] TwitchPress: check_user_token: Token has expired [03-Mar-2018 22:23:05 UTC] TwitchPress: cURL_get: TwitchPress HTTPDStatus: 422 - For example, for a user subscription endpoint, the specified channel does not have a subscription program. [03-Mar-2018 22:23:05 UTC] TwitchPress: cURL_get: TwitchPress HTTPDStatus: 422 - For example, for a user subscription endpoint, the specified channel does not have a subscription program. [03-Mar-2018 22:23:06 UTC] TwitchPress: check_application_token: Invalid app token [03-Mar-2018 22:23:06 UTC] TwitchPress: request_app_access_token: Access token returned. Requesting function was set_application_credentials + establish_application_token() and the token is pr9p5lr4fn9ixy298p0gula4nn7qk7. [03-Mar-2018 22:23:07 UTC] TwitchPress: check_application_token: Invalid app token [03-Mar-2018 22:23:07 UTC] TwitchPress: request_app_access_token: Access token returned. Requesting function was app_status + establish_application_token() and the token is oj107asn5egossp89yrs2ucvmgr4m3. [03-Mar-2018 22:23:08 UTC] TwitchPress: check_application_token: Invalid app token [03-Mar-2018 22:23:08 UTC] TwitchPress: request_app_access_token: Access token returned. Requesting function was set_application_credentials + establish_application_token() and the token is c8ks8v7uhsai491pa7mlk6622bls87.

RyanBayne commented 5 years ago

Changes have been made to improve on this specific issue and I'm about to create a new class for making calls. The new class will have better consideration for logging and creating clearer entries for monitoring activity.