简体   繁体   English

如何在 JMeter 中生成标头 oauth 令牌

[英]How to generate header oauth token in JMeter

I'm doing load testing my REST API - to hit the API request header should contain a valid token.我正在对我的 REST API 进行负载测试 - 要命中 API 请求标头应包含有效令牌。 I'm dynamically generating my request body - the same way I would like to generate header token dynamically using JMeter - what is the best approach to do that?我正在动态生成我的请求正文 - 与我想使用 JMeter 动态生成标头令牌的方式相同 - 这样做的最佳方法是什么?

In order to access the resource which requires full authorization you need to provide so called "Bearer Token" via HTTP Header Manager , you need to add Authorization header with the value of Bearer ${followed by the dynamic token}为了访问需要完全授权的资源,您需要通过HTTP Header Manager提供所谓的“Bearer Token” ,您需要添加值为Bearer ${followed by the dynamic token} Authorization标头

在此处输入图片说明

The process of obtaining the token depends on OAuth Grant Type used in your application, you need to figure out which authentication/authorization flow is being used and implement it in JMeter using HTTP Request samplers and suitable Post-Processors for correlating the dynamic values.获取令牌的过程取决于您的应用程序中使用的OAuth 授权类型,您需要确定正在使用哪个身份验证/授权流程,并使用 HTTP 请求采样器和合适的后处理器在 JMeter 中实现它以关联动态值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM