vikas5914/steam-auth

Logging out after login/refresh

continue47 opened this issue · 1 comments

In the usage example the $steam->logout() function is called which logs out the user after login. I think this is what issue #5 is refering to.

echo "<a href='" . $steam->logout() . "'>Logout</a>";

This is my modified example if anyone has issues like #5:

<?php
session_start();
require __DIR__ . '/vendor/autoload.php';

$config = array(
    'apikey' => 'xxxxxxxxxxxxxxxxx', // Steam API KEY https://steamcommunity.com/dev/apikey
    'domainname' => 'http://localhost:3000', // Displayed domain in the login-screen
    'loginpage' => 'http://localhost:3000/index.php', // Returns to last page if not set
    "logoutpage" => "",
    "skipAPI" => false, // true = dont get the data from steam, just return the steamid64
);

$steam = new Vikas5914\SteamAuth($config);

if(isset($_GET['logout'])){
    $steam->logout();
    echo'Logged out...<br/>';
}

if ($steam->loggedIn()) {
    echo "Hello " . $steam->personaname . "! ";
    echo "<a href='?logout'>Logout</a>";
} else {
    echo "<a href='" . $steam->loginUrl() . "'>Login</a>";
}

echo $steam->debug();
?>

The code in the readme was just an example code. But I think you are right, I should at least mention it or update the example code, so people don't get confused.