PHP Classes

Accessing stored profile from Facebook

Recommend this page to a friend!

      PHP OAuth Library  >  PHP OAuth Library package blog  >  How Can the PHP OAuth...  >  All threads  >  Accessing stored profile from Facebook  >  (Un) Subscribe thread alerts  
Subject:Accessing stored profile from Facebook
Summary:Intial login works but how do I access for login next time round
Messages:3
Author:Peter
Date:2017-09-05 01:19:14
 

  1. Accessing stored profile from Facebook   Reply   Report abuse  
Picture of Peter Peter - 2017-09-05 01:19:14
Hi,

Great package, I have been struggling to get round Oauth for ages and this has really helped me move forward.

I am currently integrating the Oauth into a new web app (here if you want to test: http://www.taxcalculator.info/).

Basically, I have a native registration and login based on sql.

I am now integrating the Oauth, starting with Facebook. Here is my Oauth integration flow:

1. User clicks Oauth [Facebook] and accepts access [This works]
2. User details are stored in DB [This seems to work but, access_token, access_token_secret are empty and Authorised and access_token_response are NULL]
3. {Custom} new user is created in separate native login table [This works]
4. ID from native table passed to Auth table for match on unique id [This works]
5. Session data created [This works]
6. Auth login complete and refresh [This works]

When I logout, and try to log back in, I cannot access the original facebook auth data. A new row entry with fresh info is created instead.

Should I be setting an access token / access_token_secret somewhere?

Appreciate any help, happy to pay for some support to get me on the right track.




  2. Re: Accessing stored profile from Facebook   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2017-09-08 07:36:54 - In reply to message 1 from Peter
By default the OAuth class uses sessions to store the token that may have been previously retrieved. If you logout using PHP sessions, you destroy the variables that kept the OAuth token.

Maybe you want to use the mysqli_oauth_client_class which stores OAuth data in a database using MySQL. It uses separate cookies, the OAuth data is not destroyed when you destroy PHP sessions.

  3. Re: Accessing stored profile from Facebook   Reply   Report abuse  
Picture of Peter Peter - 2017-09-08 07:42:41 - In reply to message 2 from Manuel Lemos
Thank you Manuel,

I worked that out in the end. It was my confusion of how the handshake and authentication were handled. I didn't quite understand that from the documents you have but picked it up from wider reading.

Thank you very much for this script examples, I now have it integrated with my login scripts and it works perfectly with Facebook, Twitter, LinkedIn and Google (that was my aim).

I would like to send you a donation as this really helped me, do you have a donation button? If not send me you email in PM and I will send you some through paypal.

Thanks again, nice job :)