GithubHelp home page GithubHelp logo

Comments (14)

ilzrv avatar ilzrv commented on June 17, 2024

@UndercoverNL At the time of validation, the package makes a request to https://steamcommunity.com/openid/login where all parameters are checked. If the validation fails, the user is redirected to the Steam login page. After successfully logging in to Steam, you get back to where validation is successful and the SteamData object is filled in.

This package has been working for several years, the examples are working and have been tested on clean versions of Laravel.

from laravel-steam-auth.

UndercoverNL avatar UndercoverNL commented on June 17, 2024

@ilzrv I needed to change over 50% of the controller code with actually working code from the link I posted in my original message. You are redirecting to steam in the same function as where you get the data, which is inpossible

if (!$this->steamAuth->validate()) { return $this->steamAuth->redirect(); }

$this->steamAuth->validate() will always return false since

<!--StartFragment--> return $this-&gt;request-&gt;has('openid_assoc_handle') &amp;&amp; $this-&gt;request-&gt;has('openid_signed') &amp;&amp; $this-&gt;request-&gt;has('openid_sig');<!--EndFragment-->

Will always return false to. Since this info is a response by steam, and you are retrieving this info AFTER you retrieved and validated the response sended by steam

        $data = $this->steamAuth->getUserData();

        if (is_null($data)) {
            return $this->steamAuth->redirect();
        }

that is not going to work

from laravel-steam-auth.

ilzrv avatar ilzrv commented on June 17, 2024

@UndercoverNL Most likely, a null check is not required, because the data has already been received:

if (is_null($data)) {
    return $this->steamAuth->redirect();
}

I've logged every step for you (code from readme):

public function login()
{
    info(__METHOD__);

    if (!$this->steamAuth->validate()) {
        info(__METHOD__ . ' User not logged');
        return $this->steamAuth->redirect();
    }

    info(__METHOD__ . ' User logged in');

    $data = $this->steamAuth->getUserData();

    if (is_null($data)) {
        info(__METHOD__ . ' User data is null');
        return $this->steamAuth->redirect();
    }

    info(__METHOD__ . ' User name: ' . $data->getPersonaName());
    info('Redirecting to ' . $this->redirectTo);
}

Now let's look at the logs:

# 1: Go to /login
local.INFO: App\Http\Controllers\Auth\SteamAuthController::login
local.INFO: App\Http\Controllers\Auth\SteamAuthController::login User not logged
# 2: Steam will redirect you to /login (after a successful login)
local.INFO: App\Http\Controllers\Auth\SteamAuthController::login
local.INFO: App\Http\Controllers\Auth\SteamAuthController::login User logged in
local.INFO: App\Http\Controllers\Auth\SteamAuthController::login User name: IL
local.INFO: Redirecting to /home

from laravel-steam-auth.

UndercoverNL avatar UndercoverNL commented on June 17, 2024

@ilzrv I did already fixed it my self, that is not the problem, after 5 hours of custom modifications. But I am just trying to tell you that when someone is using the exact code from the controller / routes you used in the read me it will not work at all. The request will get stuck at the first if

    if (!$this->steamAuth->validate()) {
        return $this->steamAuth->redirect();
    }

It will return you to the HOME router with no further action. What you want is make a GET request with only return $this->steamAuth->redirect(); inside the function. And as redirect link another get request named handle for example. On handle, you can retrieve the steam data. You have to use at least 2 functions.

from laravel-steam-auth.

ilzrv avatar ilzrv commented on June 17, 2024

@UndercoverNL

$this->steamAuth->validate() returns only true or false
$this->steamAuth->redirect() redirects you to the Steam login page

What's your problem?

I rechecked with a new Laravel installation. Everything works fine.

  1. Did you publish the configuration file?
  2. Did you add API keys?

from laravel-steam-auth.

UndercoverNL avatar UndercoverNL commented on June 17, 2024

@ilzrv

  1. yes
  2. yes

My problem is that $this->steamAuth->validate() always returns false

from laravel-steam-auth.

ilzrv avatar ilzrv commented on June 17, 2024

@UndercoverNL validate always returns false on direct login, should be true only when there is a redirect from Steam.

from laravel-steam-auth.

UndercoverNL avatar UndercoverNL commented on June 17, 2024

@ilzrv So you are redirecting back to the same route as where the user came from? And then validate should return true?

from laravel-steam-auth.

ilzrv avatar ilzrv commented on June 17, 2024

@UndercoverNL When you successfully log in on the Steam and click "Sign In". Then the redirect will take place to the same page but with additional parameters that will be used for checking.

from laravel-steam-auth.

UndercoverNL avatar UndercoverNL commented on June 17, 2024

@ilzrv mm, strange way of doing it, maybe define that a bit better in the read me, since the "redirect URL" needs to be the same URL as your login page.

Also, it is not using your config but the config from pterodactyl/config. Which need to be created and setup by hand

from laravel-steam-auth.

ilzrv avatar ilzrv commented on June 17, 2024

@UndercoverNL

The configuration has a description:

/*
|--------------------------------------------------------------------------
| Redirect URL
|--------------------------------------------------------------------------
|
| By default redirect_url is equal to your login url.
|
| Can be a relative url, an absolute url, or "null".
|
*/
'redirect_url' => null,

The request specifies the redirect url:

$redirectUrl = config('steam-auth.redirect_url')
? url(config('steam-auth.redirect_url'))
: $this->request->url();

Everything works out of the box. If you have any suggestions, please make a pull request.

from laravel-steam-auth.

UndercoverNL avatar UndercoverNL commented on June 17, 2024

@ilzrv laravel-steam-auth/config/steam-auth.php isn't used. config() is using the pterodactyl/config

from laravel-steam-auth.

ilzrv avatar ilzrv commented on June 17, 2024

@UndercoverNL This was tested on pure Laravel. I can't be responsible for third-party libraries.

from laravel-steam-auth.

UndercoverNL avatar UndercoverNL commented on June 17, 2024

@ilzrv I am on pure Laravel...

from laravel-steam-auth.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.