-
Notifications
You must be signed in to change notification settings - Fork 73
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
It still works? #54
Comments
+1. Any workarounds? |
Ya still works, and a work around. Let me know if you still need help |
@bozzit is there any way to make it a faster process or anything also, how can i contact you? |
I may need help. I am not able to make it work and I assume it’s because of the recent change they did when added CAPTCHA |
Yes the CAPTCHA stuff has messed things up for us here is the workaround. https://www.bungie.net/en/User/SignIn/Psnid?code=000000 This link allows you to link your PSN account to your Bungie one. Once authenticated and on the 2FA screen collect the URL will look something like: Collect the ticket_uid, and DO NOT enter the 2FA code you should of received on your phone. Using the following code: try
{
$account = new \PSN\Auth('yourpsnaccount@yourdomain.com',
'yourpsnpassword',
'7e7cf194-817d-4001-b373-8c54c0da007e', // Ticket UID in above URL
'TFA Number here');
}
catch (\PSN\AuthException $e)
{
print $e->GetError();
exit;
}
$tokens = $account->GetTokens();
print_r($tokens); This should authenticate you and provide you with Refresh token and npsso that you can use to authenticate without having to provide credentials. I store these into a database table, and every time my web app needs to interact with PSN I use those to authenticate. //****************************************************
// Retrieve refresh and npsso saved to your database
//****************************************************
$cDB = new mysqli(db_host, db_user, db_passwd, db_name);
$result = $cDB->query('SELECT * from psn_oauth_data"));
$row = $result->fetch_assoc();
$tokens = \PSN\Auth::GrabNewTokens($row['refresh']);
$tokens['npsso'] = $row['npsso'];
//****************************************************
// SAVE new refresh token back to the database
//****************************************************
$sSQL = sprintf('UPDATE psn_oauth_data SET oauth = \'%s\', refresh = \'%s\' WHERE token_id =1', $tokens['oauth'], $tokens['refresh']);
$rUpdateResultSet = $cDB->Execute($sSQL);
//****************************************************
// Do you PSN-PHP things using the new Tokens
//****************************************************
$messaging = new \PSN\Messaging($tokens);
.
.
. This has worked for me. Hope this helps. |
@bozzit appreciate the help i found that bungie link while testing stuff too haha, thanks again. |
What about this returning when authenticating, do i need the 2FA code entered in the Auth function? {"error":"invalid_credentials","error_description":"Invalid two step credentials","error_code":4420,"docs":"https://auth.api.sonyentertainmentnetwork.com/docs/","parameters":[]} |
Well not sure where you got that error from, but ya in my example above to retrieve your oauth tokens you need to supply the 2FA number. Once you have your refresh tokens, you don't need to Authenticate but just refresh them instead. |
It seems like i was hitting this when i follow this step #54 (comment) : |
@wong90 I have not tried this in about 3 weeks, but the above worked for me. I was able to authenticate and gather refresh tokens I've been using ever since. I would have to try with another PSN account the last thing I would want to do is mess up my oauth refresh tokens and lock myself out. Sony may have changed things YET again. |
I have recovered my tokens using this method just now. So it does still work |
@wong90 try this.
you should change params "client_id" in Auth Class file. "client_id" you can get in authenticated 2FA URL. the Auth code change:
|
I got it to authorize but when I request trophies url I get "Needs to upgrade for PSN access" error. Does the scope need to be updated? Here is my URL:
|
Hello @bozzit, I am updating my python port (https://github.com/mgp25/psn-api) with the latest PlayStation changes and migrating to HTTP2. And I have a question for you. While testing all the functions, all worked except sending a message (with the same format this library sends it). PSN has changed the request, but since I'm getting: b'{"error":{"code":2121729,"message":"Bad request"}}' I want to ask you if it is still working (at least for messages) with this current library. Regards |
@mgp25 If you haven't got it working yet, I can take a look at the API again to see what exactly changed. |
@Tustin I haven't yet. The request is the following one (notice that they are using HTTP2 now): :method: POST
:path: /groupMessaging/v1/messageGroups/~xxxE837DyyyB2E5C.7F6zzz27ED000ECA/messages
:authority: es-gmsg.np.community.playstation.net
:scheme: https
user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:59.0) Gecko/20100101 Firefox/59.0
accept: */*
accept-language: es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3
accept-encoding: gzip, deflate, br
content-type: multipart/mixed; boundary="---------------------------26061"
authorization: Bearer 15e000c-36p0-400a-8b53-e94e0009745f
content-length: 204
origin: https://my.playstation.com
dnt: 1
-----------------------------26061
Content-Type: application/json; charset=utf-8
Content-Description: message
{"message":{"messageKind":1,"body":"que tal?"}}
-----------------------------26061-- Since my port is using python, none of the libs were supporting http2, unless hyper. I have opened an issue there python-hyper/hyper#380 (comment) where I asked if I was doing it right: boundary = "---------------------------"+str(random.sample(range(10000, 99999), 1)[0])
header = {
'origin': 'https://my.playstation.com',
'Authorization': 'Bearer ' + self.oauth,
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:59.0) Gecko/20100101 Firefox/59.0',
'Content-Type': 'multipart/mixed; boundary='+boundary,
'accept-encoding': 'gzip, deflate, br',
'accept': '*/*',
'dnt': '1',
}
message_body = {
"message": {
"messageKind": 1,
"body": message_text
}
}
message = "\r\n"
message += boundary+"\r\n"
message += "Content-Type: application/json; charset=utf-8\r\n"
message += "Content-Description: message\r\n"
message += "\r\n"
message += json.dumps(message_body) + "\r\n"
message += boundary + "--\r\n"
conn = HTTP20Connection("es-gmsg.np.community.playstation.net:443")
request = conn.request('POST', "/groupMessaging/v1/messageGroups/"+thread_id+"/messages", headers=header, body=message)
response = conn.get_response(request)
print(response.read()) And the response I get from the code above is: {"error":{"code":2121729,"message":"Bad request"}} Regards |
Any news @Tustin? |
what a pain in the ass. you have to grab a gdam 2fa code ever time u want a token. we need something that bypasses the dam capcha to make this Automated |
Until this month, the API was working fine, now..., I get an empty array from PSN, so I receive the error:
I hope someone can help @Tustin finding a solution. |
I had to manually refresh my token several time in July using the bungie URL in this thread with success. So you should be able to manually get a new token/refresh token. |
@Argosth I made some changes to some headers to match the newest update and everything was working fine for me when I added the update background color + image stuff. So I'm not sure if that issue is because of those header changes, or if you're running an older version of the library that might not work anymore with the old headers. If you haven't, try updating with Composer and see if you notice any difference. If not, I'll need to see some example of what you're trying to do or a more detailed error message so I can try to repro the issue. Edit: nvm, just realized you posted everything in a different issue 😛. I'll take a look at your code and see if I can figure it out |
It works!!!!!!!!!, wow, nice Tustin, it works fine, I just downloaded via composer your new files, and I did not modified any files, even the Auth.php (cause someone said that I have to put mi Client_id into that file, and don't, that gave me an error), so I left all files without any modification, and now it works, thank you Tustin, now I have my trophies updated. You can visit my personal website: https://www.argosth.com, and can see that I have updated my trophies hehehe, love you Tustin, you are a master. Thanks, and I hope PSN let us continue with this system without any changes. |
@Argosth glad to hear it fixed the issue! 😄 |
@Argosth Argosth , can you tell me how you got this implented maybe you can help me so i can implented in to my website ( its wordpress ) https://playstationforum.dk |
Hey, you just have to download via (composer) the new files in the root of your site, after that, you just have to do what @bozzit commented on Jan 25 above. |
@Argosth i try that - should this be in the "Index.php" or what .. or where should i put this ? in what file |
@Argosth
|
This is all the proccess I do, it will be enough: I do everything in a file called (psn.php), is not an index.php.
Next, you should get your Ticket UID, and the password sent to your phone and use the next code.
If everything was ok, you will have now the Oauth, Refresh codes, save them in a file.txt or in a database.
** Now, you can just do FOR to see every information from the object.**
Remember to see the documentation in: http://tusticles.com/psn-php/ I hope this information is useful for you. |
my psn.php file look like this and make error
|
That error is shown when you try to get a new token information from the same data, you have only 1 attempt to get the oauth, nsspo, refresh etc, so, you go to the URL, get the Ticket UID and the 2FA code, and copy that to your file, and update, and go to your website and look, but not refresh, cause you can execute that only 1 time to see the info. Try to do it in only one time, if you refresh the website again, you will receive that error. |
The new version of the library now properly supports the 2FA login scheme to get around the Captcha issue. You don't need to store any confidential information like email and password anymore. See here: https://tusticles.com/psn-php/first_login.html |
@krazyjakee I'm also running into this "Needs to upgrade" brick wall. Were you ever able to figure out a solution? |
@GarrettAlbright I believe one cause of this can be that you need to accept some new agreement on the account. Have you tried to login with the account you're using on https://my.playstation.com and see if you encounter a new agreement to accept? |
@Ragowit This is a brand new account, so it's unlikely that there's some new ToS or something in just the couple days since I created the account. That said, I did try logging in manually to see if there was something else to accept, but the system seems to be down currently - I can't successfully log in regardless of browser or ad blocker status. Will try again later. In the meantime, my client has hypothesized it's not working because it's not a paid PSN Pro account. Would that make a difference, do you think? |
@GarrettAlbright I'm not paying for PS+ on my account, so that shouldn't be it. |
Okay, I figured it out. For the interest of others in the future, you need to log in at https://account.sonyentertainmentnetwork.com/ (not my.playstation.com), then click "PSN Profile" in the left sidebar. The right part of the page will tell you "You must update your account to continue." Click the "Next" button right below that. Sony will give you a couple more pages of form fields to fill out. After completing this, I'm able to use the library as documented (more or less - the documentation seems out of date. Might submit a PR tomorrow). |
Still no idea?
{"error":"invalid_token","error_description":"Invalid token","error_code":4097,"docs":"https://auth.api.sonyentertainmentnetwork.com/docs/","parameters":["captchatokenmissing"]}
The text was updated successfully, but these errors were encountered: