Comments (14)
@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.
@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->request->has('openid_assoc_handle') && $this->request->has('openid_signed') && $this->request->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.
@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.
@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.
$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.
- Did you publish the configuration file?
- Did you add API keys?
from laravel-steam-auth.
- yes
- yes
My problem is that $this->steamAuth->validate()
always returns false
from laravel-steam-auth.
@UndercoverNL validate
always returns false on direct login, should be true only when there is a redirect from Steam.
from laravel-steam-auth.
@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.
@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.
@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.
The configuration has a description:
laravel-steam-auth/config/steam-auth.php
Lines 5 to 15 in 12b3743
The request specifies the redirect url:
laravel-steam-auth/src/SteamAuth.php
Lines 223 to 225 in 12b3743
Everything works out of the box. If you have any suggestions, please make a pull request.
from laravel-steam-auth.
@ilzrv laravel-steam-auth/config/steam-auth.php isn't used. config() is using the pterodactyl/config
from laravel-steam-auth.
@UndercoverNL This was tested on pure Laravel. I can't be responsible for third-party libraries.
from laravel-steam-auth.
@ilzrv I am on pure Laravel...
from laravel-steam-auth.
Related Issues (3)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from laravel-steam-auth.