java - State parameter value does not match with expected value -
i have requirement in our project sign-in user using other providers facebook,google. this, using social auth plugin. working fine facebook,but googleplus , getting error "state parameter value not match expected value", error comes when user redirect in our app after google, means in getuserprofile().so how can resolve this.
dependencies : runtime "org.brickred:socialauth:4.7" compile "org.brickred:socialauth:4.7"
my socialauth controller is
def authenticate(){ socialauthconfig config = socialauthconfig.getdefault() //you can pass input stream, properties object or properties file name. config.load() //create instance of socialauthmanager , set config socialauthmanager manager = new socialauthmanager() manager.setsocialauthconfig(config) // url of application called after authentication string successurl = grailsapplication.config.auth.redirect.url // provider url should redirect authentication. // id can have values "facebook", "twitter", "yahoo" etc. or openid url string url = manager.getauthenticationurl(params.id, successurl) session.setattribute("authmanager", manager) redirect (url:url) } @secured('permitall') def getuserprofile(){ try{ // auth provider manager 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 returns 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 socialauthmanager--->"+exception.getmessage()) } }
properties file
#googleplus googleapis.com.consumer_key = xxxxxxxxxxxxxx googleapis.com.consumer_secret = xxxxxxxxxxxxxxx
this problem version , can use social auth 4.6 , works fine
Comments
Post a Comment