状态参数值与期望值不匹配

状态参数值与期望值不匹配

我的项目中要求使用其他提供商(例如facebook,google)登录用户。为此,我正在使用社交身份验证插件。它与facebook正常工作,但是与googleplus一起工作,我收到错误消息“状态参数值与期望值不匹配”,当用户在google之后重定向到我们的应用程序时出现此错误,意味着在getUserProfile()中。这个。

Dependencies are :
runtime "org.brickred:socialauth:4.7"
        compile "org.brickred:socialauth:4.7"

我的socialauth Controller 是
def authenticate(){
            SocialAuthConfig config = SocialAuthConfig.getDefault()
            //You can also pass input stream, properties object or properties file name.
            config.load()
            //Create an instance of SocialAuthManager and set config
            SocialAuthManager manager = new SocialAuthManager()
            manager.setSocialAuthConfig(config)
            // URL of YOUR application which will be called after authentication
            String successUrl = grailsApplication.config.auth.redirect.url
            // get Provider URL to which you should redirect for authentication.
            // id can have values "facebook", "twitter", "yahoo" etc. or the OpenID URL
            String url = manager.getAuthenticationUrl(params.id, successUrl)
            session.setAttribute("authManager", manager)
            redirect (url:url)
        }

        @Secured('permitAll')
        def getUserProfile(){
            try{
                // get the auth provider manager from session
                SocialAuthManager manager = (SocialAuthManager)session.getAttribute("authManager");
                // Pass request parameter map while calling connect method.
                Map<String, String> paramsMap = SocialAuthUtil.getRequestParametersMap(request);
                // call connect method of manager which returns the provider object.
                AuthProvider provider = manager.connect(paramsMap);
                Profile profile = provider.getUserProfile();
                log.debug"user profile"+profile
    //          log.debug"contact"+  provider.getContactList()
            }
            catch(SocialAuthManagerStateException exception){
                log.error("Exception occurs while connecting with SocialAuthManager--->"+exception.getMessage())
            }
        }

属性文件
#googleplus
googleapis.com.consumer_key = XXXXXXXXXXXXXX
googleapis.com.consumer_secret = XXXXXXXXXXXXXXX

最佳答案

这是Version的问题,您可以使用social auth 4.6,它可以正常工作

关于java - 状态参数值与期望值不匹配,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/27505265/

10-10 06:51