Hello!
I use webpush-java library to send requests to browser pushServices to produce push notifications for a web application. I recently saw spikes in errors on my end from WNS from my call to webpush-java's pushService.send(), particularly spiking from 3/31/22 to 4/1/22. I saw an increase in intermittent 401 Unauthorized responses being returned with an error invalid_request and error description Invalid token. The responses all had WNS related headers in the responses. I haven't changed any of my applicationServerKeys or the way we call the push service. I've also checked webpush-java pushService library for any recent changes, and there's not significant changes there either. A few examples of responses I'm seeing on my end are...
HTTP/1.1 401 Unauthorized [Content-Length: 0, X-WNS-MSG-ID: 10E192C05091AB36, X-WNS-DEBUG-TRACE: SG2PEPF000010B5, MS-CV: 8LXBo+0yu0etGpbGBPQ/Iw.0, Strict-Transport-Security: max-age=31536000; includeSubDomains, WWW-Authenticate: bearer error="invalid_request",error_description="Invalid token", Date: Fri, 01 Apr 2022 19:57:39 GMT] [Content-Length: 0,Chunked: false]
HTTP/1.1 401 Unauthorized [Content-Length: 0, X-WNS-MSG-ID: 60DE203C7FF92909, X-WNS-DEBUG-TRACE: BY3PEPF0000E9BD, MS-CV: vzDpwIihMk2WDtEgFCY9qw.0, Strict-Transport-Security: max-age=31536000; includeSubDomains, WWW-Authenticate: bearer error="invalid_request",error_description="Invalid token", Date: Fri, 01 Apr 2022 14:02:01 GMT] [Content-Length: 0,Chunked: false]
This seems to intermittently happen. Why would my tokens mismatch or be invalid if I haven't recently changed any of my keys. In addition, when I test locally to push a browser notification, I'm able to get receive a 201 response when testing on edge, firefox, and chrome. I'd imagine if we had invalid tokens, then none of our requests would work. I also saw on WNS troubleshooting page, that 401 unauthorized can also correspond to expired token errors. Could these perhaps actually be expired token errors and not us incorrectly passing over our applicationServerKey information? The similarity between these two response messages makes it hard for me to understand which could be the issue if either at all.
Do you have any further insights on what could be going on here? Did anything recently change with the way WNS handles incoming pushService.send() requests? Thank you.
Best,
Andy