Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Context variable in javascript showing up as 'Undefined'

Below is the request I am sending to my proxy :

curl
-X POST https://mydomain.com/path?scope=lol -H
'Content-Type: application/x-www-form-urlencoded' -d
'scope=openid%20accounts'

I am trying to access the scope in a javascript policy using the below expression:

context.proxyRequest.formParams['scope']

For some unknown reason, this does not work and I get the below error:

Javascript runtime error: "TypeError: Cannot read property "scope" from undefined. (ValidateRequest.js:5)"

I am able to use the other context variables like

context.proxyRequest.headers['Content-Type']
--> application/x-www-form-urlencoded
request.method
--> POST
context.proxyRequest.queryParams['scope']
-->lol

Can anyone shed some light on what might be going on with formparams and JS?

1 5 1,958
5 REPLIES 5