Hello @spalepu,
The Javascript assertion using the open source Nashorn engine which supports ECMAScript 5.1. It does not support node.js, and most node.js examples won't work with the assertion. It also does not support importing arbitrary libraries (e.g. the Google Auth Library), so examples that depend on such will also not work with the assertion.
You might consider creating a custom assertion that includes the Google Auth Library for Java and implements that provided Java example.
Or look for other ways to solve your requirement in policy by combining assertions, including the HTTP route assertion, to call Google's Auth service in similar way as the library and provided examples.
Regards,
------------------------------
Ben Urbanski
Product Manager, API Gateway
Layer7 API Management
------------------------------
Original Message:
Sent: Oct 11, 2024 04:05 PM
From: spalepu
Subject: Layer 7 API is trying to make an API call to firebase cloud messaging API . Unable to execute java script
Hi ,
I am trying to execute a java script to get OAuth tokens for firebase cloud messaging API.
The java script needs to call a service account json file .
is it possible to implement the authorization process defined in the below link in Layer 7 API Gateway . i am trying to use "execute javascript " assertion.
https://firebase.google.com/docs/cloud-messaging/migrate-v1#node.js_1