Credentials based auth sessions
project template to get a jump start. You can also watch a walkthrough of this guide below:
New
to create a new projectIntuned.json
, which serves as the IDE settingsAuth Session
tab and set the following configurations
Enable auth sessions
onAuth session type
to API created
check
, create
and refresh
functionscheck
function: This function is called before executing any authenticated action (API). If the function returns false, this signals that the auth session is expired/invalid and the auth session will be marked as expired for Recorder-based auth sessions. The API that was called will return 401 in this case.
create
function: this function is used when a new auth session needs to be created/updated. This function takes the user provides credentials and performs browser automation that logs the user into the target service.
refresh
function: this function is used to auto refresh the auth session when it expires. In most cases, the logic of the create
and refresh
functions are identical.
auth-sessions
folder and define the scripts needed to sign into the target service.create.ts
should be defined to log the user into the target service.check.ts
should be defined to verify that the auth session is valid.refresh
function default implementation will call the create
function. This is will work fine here - no need to change it.add-new-user.ts
and write the script to add a new user to the HR portal.get-claims.ts
and write the script to get the employee claimsadd-new-user
and get-claims
APIs with the auth session you created in the previous step.add-new-user
and get-claims
APIs with an simple async request
Auth Sessions
tabNew Auth Session
orange-hrm-service-account
get-claims
API and send the result to a webhook. We will create a job that does this weekly.
Creating jobs can be done via UI or API. For this example, we will use the UI. Checkout Jobs API overview for more info.
https://webhook.site/
to get a temp url. In a real scenario, you will use your own webhook url and persist the data to store.
<YOUR_WEBHOOK_URL>
with your webhook url.