I am new to GCP and deployed one of the sample spring boot app with mysql db connection. while calling a rest APIs getting below exception. What could be the reason for the same.
2021-06-26T05:56:35.029691281Zcom.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden
Info
2021-06-26T05:56:35.029699031Z{
Info
2021-06-26T05:56:35.029705107Z "code" : 403,
Info
2021-06-26T05:56:35.029711431Z "errors" : [ {
2021-06-26T05:56:35.029717697Z "domain" : "global",
Info
2021-06-26T05:56:35.029723141Z "message" : "Insufficient Permission",
Info
2021-06-26T05:56:35.029729203Z "reason" : "insufficientPermissions"
Info
2021-06-26T05:56:35.029735192Z } ],
Info
2021-06-26T05:56:35.029741632Z "message" : "Request had insufficient authentication scopes.",
Info
2021-06-26T05:56:35.029747360Z "status" : "PERMISSION_DENIED"
Info
2021-06-26T05:56:35.029753095Z}
Below endpoint works fine
@SpringBootApplication
public class EmployeeJdbcApplication {
@RequestMapping("/")
String home() {
return "This is sample jdbc mysql connection app.....";
}
public static void main(String[] args) {
SpringApplication.run(EmployeeJdbcApplication.class, args);
}
}
getting exception for below endpoints
@RestController
public class EmployeeController {
@Autowired
EmployeeService empService;
@RequestMapping(value = "/employees", method = RequestMethod.GET)
public List<Employee> getEmployees() {
return empService.getAllEmployees();
}
@RequestMapping(value = "/insertemployee", method = RequestMethod.POST)
public void insertEmployee(@RequestBody Employee employee) {
empService.insertEmployee(employee);
}
}