0

I am trying to run the socialauth grails demo from this link. For this, I have registered my app with domain http://localhost:8080/appname in the developer.facebook.com site. The login part is successfull. Unfortunately I am unable to logout. Here is my 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:

socialAuthManager.disconnectProvider(params.id)

It returns false.

As per the javadoc it says that:

/**
     * 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??
Also if someone knows some more resources regarding the api,apart from those given in code.google.com, then kindly mention it here.

rahulserver
  • 10,411
  • 24
  • 90
  • 164

2 Answers2

0

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.

If you face any issue then report it on code.google.

Tarun Nagpal
  • 964
  • 1
  • 9
  • 25
0

disconnectProvider(providerId) will disconnect from the provider, but your Helper will still be set in the session. You have to further invalidate the session.

Have a look at these links, jsf examples

http://mrj4mes.blogspot.co.za/2013/03/how-to-implement-facebook-login-in-jsf.html How to invalidate session in JSF 2.0?

Community
  • 1
  • 1