i'm having trouble when using facebook login button. i'm using oauthwebsecurity.registerfacebookclient() authentication process stopped working properly.
when click on login button can go facebook enter account (if needed) , fails on callback , then error pops up.
my externallogincallback code this
authenticationresult result = oauthwebsecurity.verifyauthentication(url.action("externallogincallback", new { returnurl = returnurl })); if (!result.issuccessful) { return redirecttoaction("externalloginfailure"); } string fbid = ""; string first_name = ""; string last_name = ""; string email = ""; if (result.extradata.keys.contains("accesstoken")) { var client = new facebookclient(result.extradata["accesstoken"]); dynamic me = client.get("me", new { fields = "email" }); session["facebooktoken"] = result.extradata["accesstoken"]; fbid = result.extradata["id"]; email = me.email; } else { string[] full_name = result.extradata["name"].tostring().split(' '); if (full_name[0] != null) first_name = full_name[0]; if (full_name[1] != null) last_name = full_name[1]; } if (oauthwebsecurity.login(result.provider, result.provideruserid, createpersistentcookie: false)) { setauthcookie(email); setencryptedcookie(configuration.usercookie, email, configuration.cookielifetime); if (request.cookies["isfromcheckout"] != null) { setcookie("isfromcheckout", false, false); removecookie("isfromcheckout"); return redirecttoaction("cart", "store"); } if (returnurl != null) { return redirect(returnurl); } return redirecttoaction("index", "store"); } if (user.identity.isauthenticated) { // if current user logged in add new account oauthwebsecurity.createorupdateaccount(result.provider, result.provideruserid, email); setauthcookie(email); setencryptedcookie(configuration.usercookie, email, configuration.cookielifetime); userservice.lastseenupdate(email); if (request.cookies["isfromcheckout"] != null) { setcookie("isfromcheckout", false, false); removecookie("isfromcheckout"); return redirecttoaction("cart", "store"); } return redirecttoaction("index", "store"); } else { // user new, ask desired membership name string logindata = oauthwebsecurity.serializeprovideruserid(result.provider, result.provideruserid); viewbag.providerdisplayname = oauthwebsecurity.getoauthclientdata(result.provider).displayname; viewbag.returnurl = returnurl; return view("externalloginconfirmation", new registerexternalloginmodel { id = fbid, username = email, externallogindata = logindata, }); }
this error shows when test on production , not while debugging.