XenorPLxx / playnite-library-psn

Playnite library extension for PSN.
MIT License
16 stars 3 forks source link

Authentication failed #22

Open bbeam23 opened 11 months ago

bbeam23 commented 11 months ago

Authentication failed for months now, nothing seems to be working.

XenorPLxx commented 11 months ago

@bbeam23

  1. What version of the add-on are you on?
  2. Which of the two authentication methods are you using?

The newest version of the plugin is 2.28 and the preferred authentication method to use is copying the NPSSO code. There's a short instruction in the add-on setting window on how to get the NPSSO code and a field to copy it to.

bbeam23 commented 11 months ago

@bbeam23

  1. What version of the add-on are you on?
  2. Which of the two authentication methods are you using?

The newest version of the plugin is 2.28 and the preferred authentication method to use is copying the NPSSO code. There's a short instruction in the add-on setting window on how to get the NPSSO code and a field to copy it to.

I have the latest version and I use the code for authentication. It worked fine before.

aa bbbbb

XenorPLxx commented 11 months ago

Have you tried going to the https://ca.account.sony.com/api/v1/ssocookie to see if you're authenticated and if the npsso token displayed is the same as put in Playnite? PSN authentication does expire now and then, especially if you use multiple browsers, for me, it expires once every two months or so. Also, if you're logging in again through the browser, remember to check the 'remember me' thingy.

bbeam23 commented 11 months ago

Have you tried going to the https://ca.account.sony.com/api/v1/ssocookie to see if you're authenticated and if the npsso token displayed is the same as put in Playnite? PSN authentication does expire now and then, especially if you use multiple browsers, for me, it expires once every two months or so. Also, if you're logging in again through the browser, remember to check the 'remember me' thingy.

It is the same code. Also, there's not even an option to keep me sign in anymore. dddddddd eeeeeeeee cccccccc

XenorPLxx commented 11 months ago

Where's the logging prompt on the third screen from? Did you log out and log in again in the browser? Sorry for asking so many questions, just want to make sure:

Screenshot 2023-10-10 at 13 33 32

In the add-on settings, use only green if you're going with NPSSO. The blue part will nullify the green part (but if you click 'Check authentication', then the green part should be the one used).

If that's how you've used it, then I'm not sure what else might be the problem. I understand that games do not update as well when you do a library update?

The last thing to check would be to remove data folder contents:

Screenshot 2023-10-10 at 13 37 11

Then go to Playnite's own settings and clean browser cache in 'Advanced' section. This will trigger a Playnite restart and would assure you have a fresh no cache state of the plugin.

rainking430 commented 9 months ago

Not sure about OP, but I too have been having this issue. Following the instructions for pasting in the code to a "T", still won't authenticate. I've also tried deleting the data contents and clearing web cache in Playnite, and it still won't work. Also, trying the legacy sign on method, after adding username and password, it gives the error "Can't connect to the server. 18.416e2c17.1701287743.8b98e01)"

umutguler commented 9 months ago

Not sure about OP, but I too have been having this issue. Following the instructions for pasting in the code to a "T", still won't authenticate. I've also tried deleting the data contents and clearing web cache in Playnite, and it still won't work. Also, trying the legacy sign on method, after adding username and password, it gives the error "Can't connect to the server. 18.416e2c17.1701287743.8b98e01)"

I second this exact issue. Presented with: Can't connect to the server. (18.358cc817.1701355127.25756276) The steps provided doesn't mitigate it at all. Using latest Playnite update.

vladohotnikov commented 4 months ago

I'm new for playnite, so it was fresh system install, But got same thing. Does anyone have solution or workaround? image

XenorPLxx commented 4 months ago

@vladohotnikov this looks correct, have you tried saving and then opening the config window and clicking 'check authentication' again? it should save automatically, but maybe it didnt. also make sure there's no trailing spaces.

vladohotnikov commented 4 months ago

@XenorPLxx Thank you for reply, It is save NPSSO value, but check authentication again give same result. Also rechecked - there are no trailing spaces

Kilmax-Yath commented 4 months ago

Hey, I'm having trouble accessing the NPSSO value, I only get a HTTP 429 Too Many Requests error. I found some other people having the same trouble, but no solution. Is there any workaround for this? The Legacy method also does not work. Any help would be appreciated.

XenorPLxx commented 4 months ago

@Kilmax-Yath unfortunately, nothing I can do about it. I'm having the same issue on random machines, even when trying to log in through the website on a macOS laptop, the issue has nothing to do with Playnite or the PSN plugin. I found that unchecking 'connect' and only checking it and synchronizing manually less often alleviates the issue to some extent. Also, trying a different browser/device helps.

Kilmax-Yath commented 4 months ago

Thanks! After posting here, I was able to access the NPSSO. I deleted all Sony cookies and tried to login again. This time, I didn't get the error! So another tip for anyone with the same problem.

XenorPLxx commented 4 months ago

Yea, I just had the same thing happen. Clear cookies, re-log on playstation.com and it works. I'm hopeful that with the next Playnite release we might be able to get the built-in browser login back again, this one seems to be cursed.

darthstark1138 commented 3 months ago

I was having the 429 problem. Also, I changed my authentication method to passkey, because I was having intermittent trouble with logging in to the PSN store. So I captured the requests during my login and found out that it was getting "npsso" from a different URL: https://ca.account.sony.com/api/authn/v3/sso. Even so, at first the value did not work. After unchecking "Connect account", saving, connecting again and passing the npsso value from this new place, authentication check worked.

XenorPLxx commented 3 months ago

Oh, interesting. For me this URL throws 405. Maybe it's related to passkey specifically.

pkluver944 commented 2 months ago

Hi, I just started using Playnite 20 minutes ago and 15 of those minutes was carefully studying this thread to get the Playstation integration working. Very frustrating, BUT it's finally worked.

Note that using a Firefox private browser causes Playstation login to error with "Can't connect". I didn't try Chrome incognito, but for anyone else struggling, Firefox private browser doesn't work, don't bother trying. I got this to work without incognito.

Here's what I did:

It's unclear what made it work this time, but it was likely either clearing the data folder, deleting cookies of old playstation websites, or enabling 2FA, or a combination of these, that made it work.

samkovacs commented 1 month ago

TL;DR:

[!TIP] If you've cleared your cache and replaced your NPSSO key to no avail, try closing and re-opening the add-on window to see if that allows you to auth.

Full summary

So after some tinkering on my end, I think that this is an issue with the Playnite cache, UI refresh, or extension's ability to reset between multiple authentication attempts.

Similar to @darthstark1138 and @pkluver944 's findings here and here.

Here are the steps that resolved this for me. Unsure if all steps are required.

  1. In non-private browser while logged in on playstation.com: clear cookies and site data.
  2. Remove the Playstation app related settings folder in %APPDATA%\Playnite\ExtensionsData
    • If you've been tinkering with this extension it should be the folder with the most recent Date Modified datetime.
  3. Login to playstation.com in a private browser.

[!NOTE] After clearing site-data in the non-private browser clicking login would bypass 2FA and login directly. Not sure if this mattered, but the NPSSO wouldn't refresh after this so that is why I switched to private browser.

  1. Retrieve your NPSSO key from https://ca.account.sony.com/api/v1/ssocookie
  2. Update plug-in
  3. Click Save which closes the extension window.
  4. Re-open extension settings and the Playstation extension should now say User is Authenticated

So, all-in-all very similar to the previous responses except that using v3 of the ssocookie api call was not necessary, nor was enabling 2FA. Though, I did already have 2FA enabled. I think the important part is the closing and re-opening of the extension window.

Next Steps

Not sure I'll dive into this, but I would curious to see the actual output of this section of code from Services/CheckAuthentication.cs while this error is occurring. Added the lines of interest for future reference by prefixing lines with +.

try
      {
+     psnClient.CheckAuthentication().GetAwaiter().GetResult();
        return true;
      }
      catch (Exception e)
      {
+       PSNLibrary.logger.Error(e, "PSN_CheckAuthentication");
        psnLibrary.PlayniteApi.Notifications.Add(
          new NotificationMessage(
            "PSN_CheckAuthentication",
            "PSN: Authentication check failed.",
            NotificationType.Error,
            () => psnLibrary.OpenSettingsView())
          );
        return false;
      }
    }

More interesting places to look: https://github.com/XenorPLxx/playnite-library-psn/blob/07544a4dff1990db48453a452c25c254b9727deb/Services/PSNClient.cs#L241 https://github.com/XenorPLxx/playnite-library-psn/blob/07544a4dff1990db48453a452c25c254b9727deb/Services/PSNClient.cs#L395 https://github.com/XenorPLxx/playnite-library-psn/blob/07544a4dff1990db48453a452c25c254b9727deb/Services/PSNClient.cs#L92