NGINX-Demos
NGINX-Demos copied to clipboard
Fix JS syntax issues
Good morning/afternoon
While trying to implement OAuth2 token introspection using Nginx Plus, I had to change a few lines in the oauth2.js script to get it to work.
There is no length property on javascript primitive type boolean, it returns undefined everytime and never enter the bloc
if (response.active.length) {
In here, response is the object representation of the introspection response. Encoding it in base64 will in fact encode [Object object] I encoded the responseBody bytes instead
response.toString('base64')
From what I was able to test caching works fine and no issue with decoding the introspection being from server response or cached value.
Cheers, Benoit