微信扫码登录时,报AuthException: Illegal redirect uri [WECHAT_OPEN]解决方法
Posted 秋9
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了微信扫码登录时,报AuthException: Illegal redirect uri [WECHAT_OPEN]解决方法相关的知识,希望对你有一定的参考价值。
【现象】
19:49:08.103 [http-nio-8080-exec-6] ERROR o.a.c.c.C.[.[localhost].[/].[dispatcherServlet] - Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is me.zhyd.oauth.exception.AuthException: Illegal redirect uri [WECHAT_OPEN]] with root cause
me.zhyd.oauth.exception.AuthException: Illegal redirect uri [WECHAT_OPEN]
at me.zhyd.oauth.utils.AuthChecker.checkConfig(AuthChecker.java:54)
at me.zhyd.oauth.request.AuthDefaultRequest.<init>(AuthDefaultRequest.java:44)
at me.zhyd.oauth.request.AuthDefaultRequest.<init>(AuthDefaultRequest.java:33)
at me.zhyd.oauth.request.AuthWeChatOpenRequest.<init>(AuthWeChatOpenRequest.java:25)
at com.example.thirdplatform.ThirdPlatformRequest.getAuthRequest(ThirdPlatformRequest.java:41)
at com.example.controller.UserPlcController.binding3rdRequest(UserPlcController.java:487)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:893)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:798)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at com.apollo.framework.filter.SqlInjectFilter.doFilter(SqlInjectFilter.java:66)
【解决方法】
String accessUri=host + "/plc/callback3rd/" + source + "?type=" + type + "&cururl=" + cururl;
String redirectUri = URLEncoder.encode(accessUri,"utf-8");
AuthRequest authRequest = ThirdPlatformRequest.getAuthRequest(source,redirectUri);
修改为:
String accessUri=host + "/plc/callback3rd/" + source + "?type=" + type + "&cururl=" + cururl;
AuthRequest authRequest = ThirdPlatformRequest.getAuthRequest(source,accessUri);
以上是关于微信扫码登录时,报AuthException: Illegal redirect uri [WECHAT_OPEN]解决方法的主要内容,如果未能解决你的问题,请参考以下文章