last day (19 days later) » 

7:10 AM
0
Q: Oauth Implementation using PHP and JS facebook SDK

saikiranHai Fellow Developers, I am implementing A facebook Login to my Web App using codeigniter (E-commerce kind of platform). So, I have lot of filters in my site based upon them i am trying to fetch data and requesting a service. so user has to log in to request a service, so at last i am forcing u...

 
are you not able to set session all our site for facebook login ?
 
@user1048123 not able to get you
 
what actually issue you are getting ? Are you not able to set session after facebook login ?
 
You know i am getting the data from facebook library to a controller but i can't able to update it in current view. i am able to set in session. since i am using JS SDK view is not redirecting here.
 
ok so you are able to set session in contoller using ajax and send response to view right ? but in view you are not able to see session changes after response right ?
 
7:10 AM
exactly, if u can see my controller from above it is setting session and echoing the response. but in view i have written like if session is set display username else display login.
 
can you share some code of view also ?
I think you miss some thing in your ajax call
 
hello
updated the view
 
ok from where you are calling ajax ?
 
in the footer
template
 
please share that too..
I think you are not refreshing page right...
 
7:13 AM
yes
$.ajax({
url:"<?php echo base_url('redirectoauth');?>",
success:function(data){
var data=$.parseJSON(data);
$('.user_name').html(data.name);
$('#userName').css('display','block')
$('#login').css('display','none');
$('#socialLogin').modal('hide');
}
});
 
if you refresh page session will be there
 
page session is not matter here
ours is kind of market place
 
yes. I got your issue
 
thanks
breaking my head from a week
 
first go to your source page and see is there any userName id present ?
 
7:14 AM
FB login really sucks
yes it is present
 
<?php if($this->session->userdata('user_name')): ?>

<li id="userName" class="dropdown">
<a href="#" id="userNameAnchor" class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Welcome <span class="user_name"><?php echo $this->session->userdata('user_name')?></span><span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="#">Account settings</a></li>
<li><a href="<?php echo base_url('redirectoauth/FbLogout')?>">Logout</a></li>
</ul>
</li>
<?php else: ?>
 
don't worry every code is done by me
 
as in your code you check for session user_name which is not set first time right
 
yes
if it is not set i will disply login
if it is set i want to display user name
 
so this li will not print on page but after success you are trying to update this li which is not present
 
7:17 AM
yes that is my problem
any workaround
u are reading my mind
:)
 
yes. Give me two mint
i will tell you how to fix it
 
okay
 
check my answer I have update your question too
I think this will fixed your issue
 
okay
 
please let me know if you face any issue
 
7:29 AM
sure ji
can me give ur any email id or ohone number
phone number
or fB ACCOUNT
 
8956216184
will back in few mints
try my answer. I am sure it will work
yes
 
facebook unset session is not working
that is why still i can see welcome
can u help me in Facebook logout from library i have written
how to logout from facebook when using javascripthelper
 
yup
will back in 15 mints
 
thanks
 
7:56 AM
yes back
with my answer are you able to see account button ?
u there?
 
8:30 AM
hai
went for lunch
i know it will work
but session is not getting destroyed
u there??
hey i ran out of charge in mobile
sorry
 
8:45 AM
Hi
 
hello
 
ok no issue
let disscuss here
 
okay
i am doing this in my logout method in the controller
session_destroy();
unset($_SESSION);
redirect(base_url());
 
you are refreshing page. And you still able to see Account settings ul li right ?
 
yes ji
 
8:48 AM
do one this just
echo '<pre>';
print_r($_SESSION);exit;
before
redirect(base_url)
and let me know the result
 
i amgetting this
Array
(
[__ci_last_regenerate] => 1437122750
[user_name] => Saikiran Marripati
)
 
ok so ur session is still there
do one thing $this->session->destory()
 
done that too
 
use this before redirect and print
 
no use
 
8:51 AM
see you still get user_name in session
if still user_name is there then try this also
$this->session->unset_userdata('user_name');
 
one second
 
sorry i think above session->destory is wrong
correct one is
$this->session->sess_destroy();
 
yeah no issues
give me one second
 
yup
 
after logout i am not seeing the li we have been talking before
but after login i am seeing the li and login too
even though i am displaying none with ajax
i am checking that
 
9:04 AM
didn't understand
 
the li issue got resolved
 
ok so session is unset now right ?
 
but after login with facebook i am still seeing the Login
yes
 
ok
issue with id there is multiple id name
socialLogin
i have updated my answer check that
Please let me know. I have online only 15 mints more
 
no there only one socialLogin
i ahven't copy pasted ur code exactly
 
9:07 AM
ok so use show and hide
$("#id").hide()
$('#id').show()
 
hey after setting the session after facebook login i can't able to see the account name li
the display solution u said is not changing
to block
 
$('#logined').css('display','block')
$('#sociallogined').css('display','none');
dont use this
try
$('#logined').show();
$('#sociallogined').hide();
 
do you have team viwer
 
what was issue with session destroy ?
 
this is going very tough
u can see what i am doing
 
9:11 AM
team viewer 9
 
okay
mine is 10
 
what is this
??
 
install this as i am ussing linux and its hard to install team viewer and windows software on this
same as teamviewer
 
okay
give me a second
 
9:15 AM
sorry going out will back in 2 hr. shafiq.rst@gmail.com
my email for further. I m online on mobile
 
hey
i solved it
thanks
will credit you the bounty
thanks for beign with me
 
Great what was the issue
You are welcome
 

  last day (19 days later) »