DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Because the DevOps movement has redefined engineering responsibilities, SREs now have to become stewards of observability strategy.

Apache Cassandra combines the benefits of major NoSQL databases to support data management needs not covered by traditional RDBMS vendors.

The software you build is only as secure as the code that powers it. Learn how malicious code creeps into your software supply chain.

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

Related

  • Why APIs Will Be This Year’s Most Targeted Service
  • API and Security: From IT to Cyber
  • When APIs Go Wrong: Neglecting Rate Limiting
  • Secure Your API With JWT: Kong OpenID Connect

Trending

  • Implementing API Design First in .NET for Efficient Development, Testing, and CI/CD
  • A Guide to Auto-Tagging and Lineage Tracking With OpenMetadata
  • Agile’s Quarter-Century Crisis
  • Traditional Testing and RAGAS: A Hybrid Strategy for Evaluating AI Chatbots
  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. OAuth API Testing With JMeter

OAuth API Testing With JMeter

This article talks about how to test OAuth API's using JMeter 5.1. There are two major steps involved in OAuth testing. Find out more!

By 
Bhaskar Gara user avatar
Bhaskar Gara
·
Jul. 02, 20 · Analysis
Likes (2)
Comment
Save
Tweet
Share
17.1K Views

Join the DZone community and get the full member experience.

Join For Free

For Installing and Overview of JMETER. Please check

https://dzone.com/articles/jmeter-tutorial-for-beginners-jmeter-load-testing

This article talks about how to test OAuth API's using JMeter 5.1

There are two major steps involved in OAuth testing:

1. Request for Token.

2. Use that token in Subsequent API as Bearer Token in the Header.

Assumption

You already reviewed the above Article before proceeding to the next steps.

Step 1: Request for a Token.

a) Right-Click the "Test Plan" and Add a new thread group. Name it as "Demo Group"

test plan

b) Right-Click the "Thread Group" --> Add --> Sampler --> HttpRequest

http request

c) Add Request details and "Save"

host name

d) Add "View Result Tree" & "JSON Token Extrator"

view results tree

json extractor

e) Now add the JSON Path Expression where you can find the token (from View Result tree --> Response).

This is my response in "View Result Tree".

JSON
 




x


 
1
{"user_context":null,"return_type":"json","access_token":"qubyczsmjbttg49rtwvbka","token_type":"bearer","expires_in":3600,"refresh_token":"cjpam8qgsd3kkbyypkfrvq6e","scope":null,"state":null,"uri":null,"extended":null}



So I added $.access_token path to the variable C_Token.

S_access_token

Step 2: Pass that Token to the Subsequent API's

a) Follow the same Step above to create an HTTP Request and add the second API

parameters

b) Add "HTTP Message Header" and "View Result Tree"

http header manager

c) Now Add the token value which you got in Step 1 - e as ${C_Token}

C_token

Follow similar steps for the remaining API.

Happy testing!

API API testing security authentication

Opinions expressed by DZone contributors are their own.

Related

  • Why APIs Will Be This Year’s Most Targeted Service
  • API and Security: From IT to Cyber
  • When APIs Go Wrong: Neglecting Rate Limiting
  • Secure Your API With JWT: Kong OpenID Connect

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!