Skip to content
This repository has been archived by the owner on Nov 23, 2021. It is now read-only.

Oauth2 flow #100

Closed
thim81 opened this issue May 17, 2021 · 1 comment
Closed

Oauth2 flow #100

thim81 opened this issue May 17, 2021 · 1 comment

Comments

@thim81
Copy link
Contributor

thim81 commented May 17, 2021

I'm trying to get the Oauth2 working based on the auth elements in the Postman collections (https://blog.postman.com/collaborating-oauth-postman/).

Looking at the https://k6.io/blog/how-to-load-test-oauth-secured-apis-with-k6/ flow, this happens best in the setup() function.

The Auth(config, Var) part is properly generated but It seem that the setup() part to get a Oauth2 token is not generated in the script.js file? Is this missing due to a bug or not supported?

Auth Part of the example postman collection:


	"auth": {
		"type": "oauth2",
		"oauth2": [
			{
				"key": "addTokenTo",
				"value": "header",
				"type": "string"
			},
			{
				"key": "audience",
				"value": {
					"ede8ad82-ae7d-4b33-b0fb-bc402c95726d": "https://example.com"
				},
				"type": "any"
			},
			{
				"key": "tokenName",
				"value": "",
				"type": "string"
			},
			{
				"key": "clientSecret",
				"value": "123456ryzT0O3ZQSGOF0j2FqF9bIY6J-idvr0RwMnJy_",
				"type": "string"
			},
			{
				"key": "clientId",
				"value": "1234578bSJzlEzX7cVWyFaKri7flu",
				"type": "string"
			},
			{
				"key": "accessTokenUrl",
				"value": "https://test.auth0.com/oauth/token",
				"type": "string"
			},
			{
				"key": "grant_type",
				"value": "client_credentials",
				"type": "string"
			},
			{
				"key": "challengeAlgorithm",
				"value": "S256",
				"type": "string"
			},
			{
				"key": "client_authentication",
				"value": "header",
				"type": "string"
			}
		]
	},

Part of the generated script.js

postman[Symbol.for("define")]({
  name: "Get App by id - Success",
  id: "76900c93-bcf3-4906-bde9-6653d2b8e63e",
  method: "GET",
  address:
    "{{baseUrl}}/apps/123456-f18c-471f-a343-d7a174822c75",
  post(response) {
    pm.test("Check Status", function() {
      pm.response.to.have.status(200);
    });
  },
  auth(config, Var) {
    config.headers.Authorization = "Bearer undefined";
  }
});
@ppcano
Copy link
Collaborator

ppcano commented Nov 22, 2021

Apologies for the inactivity on this project.

Due to the inability to properly support this project, the k6 team has decided not to continue its development. The primary reason is that k6 scope has grown significantly with the launch of k6 extensions. The team is prioritizing extending k6 capabilities over the converters.

We suggest you post your issue at api-deck/postman-to-k6. The project is active and maintained on this fork.

@ppcano ppcano closed this as completed Nov 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants