OAuth2 Authentication

Is there any chance that real OAuth2 auth can be made with k6 for Azure secured API with Authorization Code flow using PKCE. I already found a guide in the docs but it’s dedicated to login with username and password. Since upon authorization (1st GET request) callback url is returned how is possible to extract the Code which is generated in the bar, which should be used in the token (POST) request.

hey,

I just made a k6 extension xk6-oauth-pkce to generate PKCE code verifier and code challenge.

With this extension, you can follow OAuth 2.0 PKCE Flow to build the Authorization URL then follow the flow to get OAuth code/token.

1 Like