Bearer Auth Token - How to pass as header for each API resource
I am new to Ready API and API automation in general.
For our API testing (JSON), initially we have to authorize with a bearer token in SWAGGER UI. Two API resources are present /auth/login & /auth/base64 and both these return an access token and user details respectively in encrypted format. The final bearer token format is: </auth/login: accesstoken>.</auth/base64 : message>
The bearer token has session time of 15 minutes after which we need to generate a new one.
Could anyone please let me know resources or steps on how to set the bearer token details for every Test Case in Ready API?
Solved! Go to Solution.
We have a few different options here.
You could use OAuth 1 or OAuth 2 profiles to retrieve those tokens in an automated fashion. You could also automatically refresh the token after a certain duration.
OAuth 1: https://support.smartbear.com/readyapi/docs/requests/auth/types/oauth1/index.html
OAuth 2: https://support.smartbear.com/readyapi/docs/requests/auth/types/oauth2/index.htm
OAuth 2 Advanced options: https://support.smartbear.com/readyapi/docs/requests/auth/types/oauth2/advanced-options.html
Or you could add a header parameter, and pass the token to an authentication header via get data. I think we should try the authentication profiles to start as we get more automation friendly advanced options.
General auth page: https://support.smartbear.com/readyapi/docs/requests/auth/index.html