Search code examples
phpsteamsteam-web-api

Steam auth login api


When I login on one page with the steam auth login I can use all the infomation from the $steamprofile array, but when I change to another php file I dont have accses to the same $steamprofile array, how do I get this to work? I have tried to setup session_start(); on both files but diden't work.


Solution

  • If you login using the SteamAPI you get a response with all the data which can be viewed on one page, if you want it to be saved in a session you need to save this data in $_SESSION array in PHP.

    For example:

    $_SESSION['steamid'] = $steamprofile['steamid'];
    echo $_SESSION['steamid']; // on a different page
    

    You then need to include session_start() on all pages you want to share those information with. Read more about PHP session here.