cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieve authorization method in Auth Manager using Java Script assertion in Ready API

SOLVED
Highlighted
Occasional Contributor

Retrieve authorization method in Auth Manager using Java Script assertion in Ready API

I need to retrieve the authorization method created in Auth Manager using Java Script Assertion in Ready API . Is there any solution ?
Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Moderator

Re: Retrieve authorization method in Auth Manager using Java Script assertion in Ready API

Hi @Lokesh777,

 

This JavaScript code retrieves the auth method set for your project in the current environment and posts its name to the log:

var auth = context.testCase.testSuite.project.getAuthProfileHolder().getAuthProfile();
log.info(auth);

A video showing how it works for me is attached. 

 

I hope this is what you were looking for.

 

Natalie
Customer Care Team

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓

View solution in original post

5 REPLIES 5
Highlighted
Community Manager

Re: Retrieve authorization method in Auth Manager using Java Script assertion in Ready API

Hi @Lokesh777,

 

ReadyAPI supports multiple types of authorization. Please refer to the following article for details:

https://support.smartbear.com/readyapi/docs/projects/requests/auth/index.html

 

If the article doesn't help, could you please clarify your request? What exactly do you want to implement?

---------
Tanya Gorbunova
SmartBear Community Manager

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
Occasional Contributor

Re: Retrieve authorization method in Auth Manager using Java Script assertion in Ready API

Hi @TanyaGorbunova ,
We are using Java Script as "Script Language" for our Rest Project.
In one of our tests, I need to retrieve the Authorization which has been set for the project currently.
So ,I need to retrieve the "Profile name" from Auth Manager which has been set in a script assertion.

I am expecting a possible soultion for this.

Thanks in advance 🙂 

Highlighted
Moderator

Re: Retrieve authorization method in Auth Manager using Java Script assertion in Ready API

Hi @Lokesh777,

 

This JavaScript code retrieves the auth method set for your project in the current environment and posts its name to the log:

var auth = context.testCase.testSuite.project.getAuthProfileHolder().getAuthProfile();
log.info(auth);

A video showing how it works for me is attached. 

 

I hope this is what you were looking for.

 

Natalie
Customer Care Team

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓

View solution in original post

Highlighted
Moderator

Re: Retrieve authorization method in Auth Manager using Java Script assertion in Ready API

Thanks everyone for looking into this.

@Lokesh777, is this what you were looking for? Can we mark Natalie's reply as a solution?


Olga Terentieva
SmartBear Assistant Community Manager

Highlighted
Occasional Contributor

Re: Retrieve authorization method in Auth Manager using Java Script assertion in Ready API

@NBorovykh  Thanks for the solution 🙂

New Here?
Join us and watch the welcome video:
Announcements
TechCorner Leaderboard
Want a fun and easy way to learn ReadyAPI and show off your skills? Try solving weekly TechCorner challenges and get into the Leaderboard!


Challenge Status

Compare an expected JSON value and actual response in Events

Participate!

Fetch value/data from JSON response using Groovy Script

See replies!

Filtering data retrieved from a DataSource

See replies!

Get data from Petstore and add it to Excel sheets

Participate!
Top Kudoed Authors