# 添加FeignClient访问其他微服务权限
> 其他步骤参考【为提供者添加资源防护】
```java
package com.gosuncn.config;
@Configuration
public class FeignClientOAuth2RelayConfig {
@Bean
public FeignClientOAuth2RelayRequestInterceptor feignClientOAuth2RelayRequestInterceptor() {
return new FeignClientOAuth2RelayRequestInterceptor();
}
public static class FeignClientOAuth2RelayRequestInterceptor implements RequestInterceptor {
@Override
public void apply(RequestTemplate template) {
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
if (requestAttributes != null) {
String token = ((ServletRequestAttributes) requestAttributes).getRequest().getHeader("Authorization");
if (token != null && !"".equals(token.trim())) {
template.header("Authorization", token);
}
}
}
}
}
```