Restful auth with predefined variable

Hi All
I am testing retool on prem to connect with one of our systems running restful with a swagger interface.

I have followed the auth guide using thr form method and have been able to successfuly recieve an auth key however i would like to use predefined fields to connect.

I used the form method as mentioned using the below fields and had no issues if i manually typed in the data however cannot for the life of me work out how to staticaly set the 3 fields to use on a app and refresh the key every 20 minutes.

Fields are

UserId
Password
LocationId

in the custom auth workflow i defined the 3 variables above

variable name: UserId
Value of variable: {{ http1.body.json.569854785253 }}
(Number is the user ID for example)

In the API Request i was using POST with the correct direct link to the authorisation. as mentioned it works with the form.

Headers
UserId : User Id
and so on

in the gneral headers i was using
UserId : token UserId

I know im compleatly way off but i got to start somehwere right?

Is there a guide on how to statically set a username and password for auth in a resource i can use?

Cheers

Hey @pete82! Would you mind sharing a screenshot of your current setup?

Hi Victoria.

Im glad to say i worked the first part of the auth out and am now able to get an API key returned.

Setting below





When i now run the resource, it returns with a API key to use that lasts 20 Minutes as shown in the responce

"http1": {
"body": {
"ApiKey": "J6GnQ01w5mRUs/EW2La3ducqCwLyjNDxSDCCfp2RLGIgRgXchEPJrQ==",
"ApiKeyExpiration": 20
},

How can i have my resource use the API key that was returned to run future query's in my app and have it set so every time the app runs it fetches a new API key to ensure the time limit never expires?

Cheers!

Hmm! Glad you were able to get so far :slight_smile:

Quick question, is your auth endpoint setup to support a refresh auth workflow? https://docs.retool.com/docs/custom-api-authentication#refresh-auth-workflow