响应:{“httpcode”:“400”,“httpmessage”:“错误请求”,“moreinformation”:“api请求中缺少一个或多个必需的api参数。”}
从日志中,我可以看到所有参数的传递方式如下:grant\u type=client\u credentials&scope=ban&client\u id=sample&client\u secret=sample
@FeignClient(name = "tru", url = "${api.tru.url}", configuration = TruConfig.class)
public interface TruClient {
@PostMapping(value = "/tru/oauth2/token", consumes = APPLICATION_FORM_URLENCODED_VALUE)
AuthTokenResponse getAccessToken(@RequestBody MultiValueMap<String, ?> formParams);
class FeignSupportConfig {
@Autowired
private ObjectFactory<HttpMessageConverters> messageConverters;
@Bean
public Encoder feignFormEncoder() {
return new FormEncoder(new SpringEncoder(messageConverters));
}
}
}
1条答案
按热度按时间kfgdxczn1#
我认为“范围”是不必要的。请参阅此处的文档https://auth0.com/docs/flows/call-your-api-using-the-client-credentials-flow 你的参数应该是这样的