pig项目feign调用登录/oauth/token接口;pig4cloud项目feign调用登录/oauth/token接口;feign调用OAuth2登录接口;feign调用oAuth2登录接口


 开始没加 headers = {"Content-Type: multipart/form-data", "Authorization=Basic cGlnOnBpZw=="} 一直请求报401

 feign调用401

import com.pig4cloud.pig.common.core.constant.SecurityConstants;
import com.pig4cloud.pig.common.core.constant.ServiceNameConstants;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

@Service
@FeignClient(value = ServiceNameConstants.AUTH_SERVICE, fallbackFactory =PiaAuthServiceFallbackFactory.class)
public interface PigAuthService {

    @PostMapping(value = "/oauth/token", headers = {"Content-Type: multipart/form-data", "Authorization=Basic cGlnOnBpZw=="})
    Object oauth( @RequestParam Map<String, String> parameters, @RequestHeader(SecurityConstants.FROM) String from);
}

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM