2

I have recorded scripts for all test cases, and run all test cases due to the OAuth 2.0 it is failing all of the test cases.
Now I have to authenticate OAuth 2.0 in JMeter, I have following information:

client_id, response_mode, protectedtokena, response_type, resources, scope, nonce,redirect_uri,wsucxt, cobrandid, client-request-id.

Vadim Yangunaev
  • 1,817
  • 1
  • 18
  • 41
surender pal
  • 447
  • 6
  • 15

1 Answers1

0
  1. Add (or parametrize) parameter Authorization in your HTTP Header Manager. Add Bearer ${AuthToken} value. You should parse that token from previouse request.

  2. Check this guide about How to parse auth token

Vadim Yangunaev
  • 1,817
  • 1
  • 18
  • 41
  • [{"user_id":=====, "network_id":====, "network_permalink":"ncr.com", "network_name":"NCRCorporation", "network_canonical":true, "network_primary":true, "token":"=============", "secret":"===============", "view_members":true, "view_groups":true,"view_messages":true, "view_subscriptions":true, "modify_subscriptions":true, "modify_messages":true, "view_tags":true, "created_at":"2018/10/16 05:17:25 +0000", "authorized_at":"2018/10/16 05:17:25 +0000", "expires_at":null }] – surender pal Jan 31 '19 at 07:09
  • Could you provide screenshots of your current Test Plan and result of one test run with one Thread in View Result Tree? – Vadim Yangunaev Jan 31 '19 at 13:32
  • @surenderpal I've edited my answer, check this two steps. – Vadim Yangunaev Jan 31 '19 at 14:05
  • @Yangunaev I'm sharing the screenshot of the test but one question I'm getting the token at the end of the of the script then how should I automate it for the beginning of the script.https://imgur.com/a/cmJicPk – surender pal Jan 31 '19 at 17:20
  • As shown on you screen, you recorded this tokens once. For the next session they will be different. That's why your next test runs fails. You should not send id_token and other parameters as constant. You need to parse theirs values from the previous requests, such login. Probably it is in auth\sso request - you should add ReExp Extractor to it. Check the 2nd link at my answer and this link to clarification: https://ecosmobian.wordpress.com/2017/01/11/handling-bearer-token-for-web-application-in-jmeter/ – Vadim Yangunaev Jan 31 '19 at 21:37