Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Easy fix when using PHP include #6

Open
atchoo78 opened this issue Jul 20, 2016 · 4 comments
Open

Easy fix when using PHP include #6

atchoo78 opened this issue Jul 20, 2016 · 4 comments

Comments

@atchoo78
Copy link

Thank you for this great PHP implementation of Account kit functionality.

This may be self-explanatory for many, but maybe it will help someone:
I placed the main PHP code (the actual login functions/session variables) in a separate PHP page that I included from my main page, and modified
$final = json_decode($result); to $_SESSION['final'] = json_decode($result);, and of course replaced every instance of $final with $_SESSION['final']

Example: <?=$_SESSION['final']->email->address?>.

I also modified !isset($_SESSION) to!isset($_SESSION['final']) in the session check, just in case.

That way, the user info is easy accessible from anywhere on the website/app as long as the user is logged in. Just my 5 cents, or something :)

@BeDataAnalyst
Copy link

I can't make it work it for emailogin. I replaced all $final to $_SESSION['final'] and still not working

can please help me?

@atchoo78
Copy link
Author

atchoo78 commented Jul 19, 2017

Did you start the session?

  • Place this at the very top of the php file with the login code:

if (!isset($_SESSION)) { session_start(); }

  • Also, from your main page, try

echo "<pre>" . $_SESSION . "</pre>";

…to check which session variables are set (and if the session is in fact started).

I haven't used the account kit since last summer, so I can't verify if it's still working. It seems very likely that someone changed the code since july 2016 though.

@BeDataAnalyst
Copy link

BeDataAnalyst commented Jul 19, 2017

Hi friend thanks for help!

Yes session its start cause when i confirrm the mail pass trought

if(is_session_started() === FALSE && !isset($_SESSION)){
shows me correct the html for when you login

When i add this:
echo "<pre>" . $_SESSION . "</pre>";

Shows me the word "Array"

@BeDataAnalyst
Copy link

Friends,

The issue its on the setting. Don't on the option "Required App Secret"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants