-
Notifications
You must be signed in to change notification settings - Fork 6
Description
I am trying simple quick docker compose installation and simple java code to try out VRT with java. Though I am giving all correct inputs as api key token, project id, branch name I am getting 405 forbidden resource error while visualRegressionTracker.start(); call
Installation:
IVR installed with default docker compose command.
sdk-java version: 5.2.1
Java code:
VisualRegressionTrackerConfig config = new VisualRegressionTrackerConfig(
// apiUrl - URL where backend is running
"http://localhost:4200",
// project - Project name or ID
"9502d386-eb40-4841-a79a-0eb2ae160cd8",
// apiKey - User apiKey
"XXXXXXXXXXXXXXXXXXXXX",
// branch - Current git branch
"qa",
// ciBuildId - id of the build in CI system
"commit_sha",
// enableSoftAssert - Log errors instead of exceptions
false,
// httpTimeoutInSeconds - define http socket timeout in seconds (default 10s)
15
);
VisualRegressionTracker visualRegressionTracker = new VisualRegressionTracker(config);
visualRegressionTracker.start();
Exception:
Exception in thread "main" io.visual_regression_tracker.sdk_java.TestRunException: {"path":"/builds","name":"ForbiddenException","message":"You do not have permission to perform this operation.","exception":{"response":{"message":"Forbidden resource","error":"Forbidden","statusCode":403},"status":403,"options":{},"message":"Forbidden resource","name":"ForbiddenException"},"stack":"ForbiddenException: Forbidden resource\n at canActivateFn (/node_modules/@nestjs/core/router/router-execution-context.js:136:23)\n at async /node_modules/@nestjs/core/router/router-execution-context.js:42:31\n at async /node_modules/@nestjs/core/router/router-proxy.js:9:17"}
at io.visual_regression_tracker.sdk_java.VisualRegressionTracker.handleResponse(VisualRegressionTracker.java:172)
at io.visual_regression_tracker.sdk_java.VisualRegressionTracker.start(VisualRegressionTracker.java:54)
I tried http://localhost:4200/api (swagger API interface) I observed it needs bearer token. I was unsure on how to get bearer token (could not find documentation) so I took it from Authorization header after browser login. with this bearer token Swagger api works fine.
As per my understanding we do not need bearer token to be given in java code as we only need backend api token. Please give us some information here. If i need to give bearer token in java code , how to I generate it and how I am suppose to pass it? Any example/ docs would be appreciated.