Skip to main content

Get Started

First, we'll install the package. Then, we'll make our first authentication to the PlayStation Network. After these steps are completed, you are able to use any function provided by the library.

Quick Start

Install the package:

npm install psn-api

You will need to be authorized to use the PSN API. To authenticate manually, follow these steps:

  1. In your web browser, visit the PlayStation homepage, click the "Sign In" button, and log in with a PSN account.

  2. In the same browser (due to a persisted cookie), visit this page. You will see a JSON response that looks something like:

{ "npsso": "<64 character token>" }

If you see an error response, try using a different browser.

  1. You can now obtain an authentication token using your NPSSO with the following function calls from this package.
// This is the value you copied from the previous step.
const myNpsso = "<64 character token>";

// We'll exchange your NPSSO for a special access code.
const accessCode = await exchangeNpssoForCode(npsso);

// ๐Ÿš€ We can use the access code to get your access token and refresh token.
const authorization = await exchangeCodeForAccessToken(accessCode);
  1. You now have all you need to use any function in the API. Each function takes this authorization object as its first argument. To be more precise, the functions are looking for your accessToken value. Here's an example:
// This returns a list of all the games you've earned trophies for.
const trophyTitlesResponse = await getUserTitles(
{ accessToken: authorization.accessToken },