Our application is using O-Auth2 protocol for authentication. Once i login to the system i see the token API which is generating the Access Token which is utilized for further APIs. Now this API has a payload with code and code verifier information. Both of these code and code verifier values are dynamic. Problem is i don't see any previous APIs which are generating these two values. So i am not sure how to extract the values and pass on to this Token API's payload. Already talked to BE guy and they are saying these values are getting generated through some Keytool package. So i am stuck in making these values dynamic and to run token API from JMeter. Any elaborate explanation will be really appreciated.
Code verifier is something you need to generate, example code can be found at i.e. Create code verifier page, translated into JMeter's JSR223 Test Elements and Groovy language it would be something like:
import java.security.SecureRandom;
SecureRandom sr = new SecureRandom();
byte[] code = new byte[32];
sr.nextBytes(code);
String verifier = Base64.getUrlEncoder().withoutPadding().encodeToString(code);
log.info('code_verifier: ' + verifier)
vars.put('verifier', verifier)
Then refer generated value as ${verifier}
where required.
With regards to "code" - this is something you need to extract from the response