Skip to content

Commit 9bf2820

Browse files
added liquid auth example
1 parent fe67bae commit 9bf2820

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

docs/liquid.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,3 +367,28 @@ Error gotten:
367367

368368
![13 01 2022_06 18 16_REC](https://user-images.githubusercontent.com/31187099/149260752-e7f37489-9095-4080-a0b7-2b04c53405a4.png)
369369

370+
## App Auth
371+
372+
You can use liquid python to define app auth parameters dynamically. For example, you can create a JWT token for authentication using the `jwt` library in python.
373+
374+
```
375+
{% python %}
376+
import jwt
377+
def generate_token():
378+
key = {"customerName":"","accessID":"","description":"","accessKey":"","adminRestApiUrl":""}
379+
exp = time.time() + 60 * 60
380+
jwt_claims = {
381+
"iat": time.time(), # Set issued at time to the current time.
382+
"exp": exp, # Set expiration time
383+
"aud": key["adminRestApiUrl"], # Audience of the claim.
384+
"sub": key["accessID"], # Access ID from the Admin API Key.
385+
}
386+
387+
# Use the accessKey from the Admin API key file and the RS256 algorithm to generate the JWT
388+
return jwt.encode(jwt_claims, key["accessKey"], algorithm="RS256")
389+
390+
print(generate_token())
391+
{% endpython %}
392+
```
393+
394+
Provide this python script in the app auth token field to generate a new JWT token for each execution. The code get executed when the app is used in a workflow. You can modify the code to fit your app auth requirements.

0 commit comments

Comments
 (0)