简体   繁体   English

无法使用SocialAuth Java API从Facebook注销

[英]Unable to logout from facebook using socialauth java api

I am trying to run the socialauth grails demo from this link. 我试图运行socialauth的Grails从演示这个链接。 For this, I have registered my app with domain http://localhost:8080/appname in the developer.facebook.com site. 为此,我已经在developer.facebook.com站点中将我的应用注册为域http://localhost:8080/appname The login part is successfull. 登录部分成功。 Unfortunately I am unable to logout. 不幸的是我无法注销。 Here is my SocialAuthController: 这是我的SocialAuthController:

package org.brickred

import org.brickred.socialauth.SocialAuthManager
import org.codehaus.groovy.grails.web.pages.ext.jsp.GroovyPagesPageContext

import de.deltatree.social.web.filter.api.SASFHelper
import de.deltatree.social.web.filter.api.SASFStaticHelper

class SocialAuthController {

def index = {
    println "id:::"+params.id;
    redirect(uri: "/SAF/SocialAuth?id=${params.id}")
}

def signout = {
    SASFHelper helper = SASFStaticHelper.getHelper(request)
    SocialAuthManager socialAuthManager
    if(helper!=null){
        socialAuthManager = helper.getAuthManager()
        if(socialAuthManager != null){
            socialAuthManager.disconnectProvider(params.id)
        }else{
            flash.message = "Unable to logout from "+params.id
        }
    }else{
        flash.message = "Unable to logout from "+params.id
    }
    redirect(uri: "/index.gsp")
}
}

Which is same as the demo link as given above. 与上面的演示链接相同。 When I debug it from the STS IDE, in the line: 当我从STS IDE调试它时,在一行中:

socialAuthManager.disconnectProvider(params.id)

It returns false. 返回false。

As per the javadoc it says that: 根据javadoc,它说:

/**
     * It disconnects with provider
     * 
     * @param id
     *            the provider id
     * @return True if provider is disconnected or false if not.
     */
    public boolean disconnectProvider(final String id) {
            if (providersMap.get(id) != null) {
                    AuthProvider p = providersMap.get(id);
                    p.logout();
                    providersMap.remove(id);
                    return true;
            }
            return false;

    }

Frankly to mention, the api has good features, but it is lacking a robust set of tutorials/online resources.So can anyone guess what is going on with my code?? 坦率地说,该api具有良好的功能,但缺少一套可靠的教程/在线资源。因此,谁能猜出我的代码是怎么回事?
Also if someone knows some more resources regarding the api,apart from those given in code.google.com, then kindly mention it here. 另外,如果除了code.google.com中提供的资源之外,还有其他人知道有关该api的其他资源,请在此处进行提及。

I tried given demo and it is working fine. 我尝试了给定的演示,它工作正常。
You can download the latest socialauth-java-sdk-4.2 and get the grails demo from the example folder and try to run. 您可以下载最新的socialauth-java-sdk-4.2并从示例文件夹中获取grails演示,然后尝试运行。

If you face any issue then report it on code.google . 如果您遇到任何问题,请在code.google上报告

disconnectProvider(providerId) will disconnect from the provider, but your Helper will still be set in the session. detachProvider(providerId)将与提供程序断开连接,但仍将在会话中设置您的Helper。 You have to further invalidate the session. 您必须进一步使会话无效。

Have a look at these links, jsf examples 看看这些链接,jsf示例

http://mrj4mes.blogspot.co.za/2013/03/how-to-implement-facebook-login-in-jsf.html How to invalidate session in JSF 2.0? http://mrj4mes.blogspot.co.za/2013/03/how-to-implement-facebook-login-in-jsf.html 如何在JSF 2.0中使会话无效?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM