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

[V3] Where to start with master-branch ? #176

Closed
Reuns opened this issue Jul 5, 2021 · 18 comments
Closed

[V3] Where to start with master-branch ? #176

Reuns opened this issue Jul 5, 2021 · 18 comments
Labels

Comments

@Reuns
Copy link

Reuns commented Jul 5, 2021

Hello.
I was using V2.1.3 before it stopped.
Now I've downloaded the master-branch but I don't know where to start.

I'm a bit lost (completely actually) and without any doc I can't do anything :(
Can someone provide me some help please ?

I'm stuck at the very beginning.
Thanks.

@isFakeAccount
Copy link

isFakeAccount commented Jul 8, 2021

You can use my version of PSN API https://github.com/isFakeAccount/psnawp. Since it is in python it should be easy to use.

The authentication work as of now. There is an issue with messaging endpoints. But if you are not using them, you should be fine.

Unfortunately, Tustin is MIA as of now due to workload,

@Reuns
Copy link
Author

Reuns commented Jul 8, 2021

You can use my version of PSN API https://github.com/isFakeAccount/psnawp. Since it is in python it should be easy to use.

Thank you for your help but I need a php version.

@Ragowit
Copy link
Collaborator

Ragowit commented Jul 8, 2021

require_once("/path/to/vendor/autoload.php");

use Tustin\PlayStation\Client;

$client = new Client();
$client->loginWithNpsso("your npsso");

foreach ($client->users()->search("Reuns") as $user) {
    foreach ($user->trophyTitles() as $trophyTitle) {
    }
}

@Reuns
Copy link
Author

Reuns commented Jul 9, 2021

Ok, just that simple (i feel ashamed). Thank you @Ragowit

How does the refreshToken works on this version ?
I tried to save
$client->getRefreshToken()->getToken ()
And use it like
$client->loginWithRefreshToken ($mypreviouslysavedtoken)
but it doesn't seems to work ... Fatal Error

Fatal error: Uncaught Tustin\Haste\Exception\ApiException in /[...]/vendor/tustin/haste/src/Http/Middleware/ResponseHandlerMiddleware.php:57 Stack trace: #0 /[...]/vendor/tustin/haste/src/Http/Middleware/ResponseHandlerMiddleware.php(32): Tustin\Haste\Http\Middleware\ResponseHandlerMiddleware->handleErrorResponse(Object(GuzzleHttp\Psr7\Response), Object(Tustin\Haste\Http\JsonStream)) #1 /[...]/vendor/guzzlehttp/promises/src/FulfilledPromise.php(41): Tustin\Haste\Http\Middleware\ResponseHandlerMiddleware->__invoke(Object(GuzzleHttp\Psr7\Response)) #2 /[...]/vendor/guzzlehttp/promises/src/TaskQueue.php(48): GuzzleHttp\Promise\FulfilledPromise::GuzzleHttp\Promise{closure}() #3 /[...]/vendor/guzzlehttp/promises/src/Promise.php(248): GuzzleHttp\Promise\TaskQueue->run(true) #4 /home/brre5190/publ in /[...]/vendor/tustin/haste/src/Http/Middleware/ResponseHandlerMiddleware.php on line 57

@Ragowit
Copy link
Collaborator

Ragowit commented Jul 9, 2021

The refreshToken doesn't work at all afaik. Don't think it's a thing anymore with the new API. Remember that the master-branch is under development and some stuff in there might just be legacy code that is meant to be removed at some point, and I believe refreshToken is one of those things.

I just use loginWithNpsso all the time within my code. It usually lasts for about two months before I need to update the npsso. I've tried to have a second dummy account as backup if the first one fails to login, but it seems that if one of my npsso needs to be refreshed, all my npsso needs to be refreshed. It's like Sony uses a button that forces a new npsso token on all users at certain intervals.

@Reuns
Copy link
Author

Reuns commented Jul 9, 2021

Ok, good to know.
I guess I'll have to keep an eye on this npsso ;)

I'll try to find my way with the code. Thanks again, I hope I won't have to bother you again.

See ya. ;)

@Tustin
Copy link
Owner

Tustin commented Jul 15, 2021

@Reuns Sorry about this. The new API is quite a bit of a different beast and I've yet to sit down and write documentation for it. If there's anything in particular you need help porting over, please let me know and I can try to help 😄

@Tustin
Copy link
Owner

Tustin commented Jul 15, 2021

@Reuns I just fixed the loginWithRefreshToken method in 450ec04. Please try it again 👍

$client->loginWithRefreshToken('5d37cd0e-4d33-xxxx-afb2-xxxxxxxxxx');

var_dump($client->getAccessToken()->getToken());

@jeroenbourgois
Copy link

@Tustin did you have any luck finding the old 'gamelist' endpoint yet? I have been searching and trying a lot of endpoints, also trying to reverse-engineer the Android app, but no luck. Trophies are accessible, but game info I have no idea.

@quangtn
Copy link

quangtn commented Jul 22, 2021

i've been using kvickpsn, it worked great so far until about a month ago. Endpoints for 'threads' stop working and always return rate limit error. It'd be great if anyone share some insight on that.

@Reuns
Copy link
Author

Reuns commented Aug 30, 2021

Hey, back on track ! For real this time...
Thanks @Tustin, login with token works great.

Why do I have
<b>Fatal error</b>: Uncaught Tustin\Haste\Exception\AccessDeniedHttpException in /home/brre5190/public_html/scoring.high-score.fr/core/vendor/tustin/haste/src/Http/Middleware/ResponseHandlerMiddleware.php:61

I'm not good with the try / catch thing. this is what i've tried

$user = $client->users()->find($accountId); try { $user->trophySummary ()->fetch (); } catch (AccessDeniedHttpException $e) { echo $e->getMessage (); }
But still ... I have the same message.
Is there something I'm doing wrong ?
Thanks.

@Reuns Reuns changed the title Where to start with master-branch ? [V3] Where to start with master-branch ? Sep 1, 2021
@Argosth
Copy link

Argosth commented Sep 28, 2021

Hey, back on track ! For real this time... Thanks @Tustin, login with token works great.

Why do I have <b>Fatal error</b>: Uncaught Tustin\Haste\Exception\AccessDeniedHttpException in /home/brre5190/public_html/scoring.high-score.fr/core/vendor/tustin/haste/src/Http/Middleware/ResponseHandlerMiddleware.php:61

I'm not good with the try / catch thing. this is what i've tried

$user = $client->users()->find($accountId); try { $user->trophySummary ()->fetch (); } catch (AccessDeniedHttpException $e) { echo $e->getMessage (); } But still ... I have the same message. Is there something I'm doing wrong ? Thanks.

Hello Reuns, did you manage to solve that exception? I'm still doing this:

require_once '../vendor/autoload.php';
use Tustin\PlayStation\Client;
$client = new Client();
/* First Login */
$client->loginWithNpsso('Npsso-Code');
$refreshToken = $client->getRefreshToken()->getToken();

// Your games
foreach ($client->users()->search("Argosth") as $user) {
foreach ($user->trophyTitles() as $trophyTitle) {

}

}

But still getting the error: Fatal error: Uncaught Tustin\Haste\Exception\AccessDeniedHttpException in C:\xampp\htdocs\Argosth\vendor\tustin\haste\src\Http\Middleware\ResponseHandlerMiddleware.php:61 Stack trace: #0

Any ideas?

Thank you :)

@Reuns
Copy link
Author

Reuns commented Sep 28, 2021

Hi @Argosth

I don't have any error at this point.
$client->users()->find($accountId)->trophyTitles() works great.

Can you share us more of your code ?

@Argosth
Copy link

Argosth commented Sep 29, 2021

Hi @Argosth

I don't have any error at this point. $client->users()->find($accountId)->trophyTitles() works great.

Can you share us more of your code ?

Hello, thank you, here is all my steps until now:

My composer version is:

guzzlehttp/guzzle 7.3.0 Guzzle is a PHP HTTP client library
guzzlehttp/promises 1.4.1 Guzzle promises library
guzzlehttp/psr7 2.0.0 PSR-7 message implementation that also provides common utility me...
myclabs/php-enum 1.7.7 PHP Enum implementation
nesbot/carbon 2.53.1 An API extension for DateTime that supports 281 different languages.
psr/http-client 1.0.1 Common interface for HTTP clients
psr/http-factory 1.0.1 Common interfaces for PSR-7 HTTP message factories
psr/http-message 1.0.1 Common interface for HTTP messages
ralouphie/getallheaders 3.0.3 A polyfill for getallheaders.
symfony/deprecation-contracts v2.4.0 A generic function and convention to trigger deprecation notices
symfony/polyfill-mbstring v1.23.1 Symfony polyfill for the Mbstring extension
symfony/polyfill-php80 v1.23.1 Symfony polyfill backporting some PHP 8.0+ features to lower PHP ...
symfony/translation v5.3.7 Provides tools to internationalize your application
symfony/translation-contracts v2.4.0 Generic abstractions related to translation
tustin/haste v1.0.6 HTTP library for my API library projects
tustin/psn-php dev-master 3dcfc62 PHP wrapper for the PlayStation API.

I think, I have the dev psn-api, because I modified the composer.json with the next code and used composer update:
{ "require": { "tustin/psn-php": "dev-master" } }

Now, I used the next method to log in with npsso:

require_once '../vendor/autoload.php'; use Tustin\PlayStation\Client; $client = new Client(); /* First Login */ $client->loginWithNpsso('my-code'); $refreshToken = $client->getRefreshToken()->getToken();

After that, I call the functions with the next code:

foreach ($client->users()->search("Argosth") as $user) {
foreach ($user->trophyTitles() as $trophyTitle) {

}
}

At this moment is when the error appears, any ideas?

@Reuns
Copy link
Author

Reuns commented Sep 29, 2021

I can't see what's wrong with your code.
Have you tried to catch the exception ?

@Argosth
Copy link

Argosth commented Sep 29, 2021

I can't see what's wrong with your code. Have you tried to catch the exception ?

No Reuns, how can I try/catch that exception inside a loop?

@Reuns
Copy link
Author

Reuns commented Sep 29, 2021

Sorry, I can't help you,
My skills are limited...

@stale
Copy link

stale bot commented Nov 30, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Nov 30, 2021
@stale stale bot closed this as completed Dec 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants