Tustin / psn-php

A PHP wrapper for the PSN API
https://tustin.dev/psn-php/
MIT License
353 stars 73 forks source link

API Endpoints, need help #168

Closed BenZero closed 3 years ago

BenZero commented 3 years ago

Hi @ll

I used the now old login method to get new community Posts and replys but since they deactivated login v2 two weeks ago its not working anymore , looks like the new login method doesnt have the SCOPEs which are needed by the endpoint

The Endpoin i called was COMMUNITIES_URL: "https://communities.api.playstation.com/v1/communities/" the scope which was needed is kamaji:communities but if add this to the new login method i get an INVALID_SCOPE error , does anyone know if there is a way to connect to the communities API with the new login method ?

Best Regards

Tustin commented 3 years ago

I don't believe it's possible anymore. They removed communities from PS5 and from the latest app so if I had to guess, they probably deprecated the feature.

pacMakaveli commented 3 years ago

The old API is still functional as of right now. You can still use the old way of obtaining an access_token as your Bearer authorization and it'll return.

curl --location --request GET 'https://communities.api.playstation.com/v1/communities?field=npId,onlineId,accountId,avatarUrls,plus,aboutMe,languagesUsed,trophySummary(@default,level,progress,earnedTrophies),isOfficiallyVerified,personalDetail(@default,profilePictureUrls),personalDetailSharing,personalDetailSharingRequestMessageFlag,primaryOnlineStatus,presences(@default,@titleInfo,platform,lastOnlineDate,hasBroadcastData),requestMessageFlag,blocking,friendRelation,following,consoleAvailability%27' \
--header 'Cache-Control: no-store' \
--header 'Authorization: Bearer {{access_token}}'
{
    "size": 3,
    "total": 3,
    "offset": 0,
    "communities": [
        {
            "backgroundImage": {
                "sourceUrl": "https://satchel-cdn.api.playstation.com/communities/483876a0-6751-11e5-a4cb-061d9b1a0df3/8a652448-58be-442b-b000-143f78602faa.png",
                "resizeTemplate": "https://image.api.np.km.playstation.net/images/?format=png&image=https%3A%2F%2Fsatchel-cdn.api.playstation.com%2Fcommunities%2F483876a0-6751-11e5-a4cb-061d9b1a0df3%2F8a652448-58be-442b-b000-143f78602faa.png&sign=bbcdb712207d1aa55b69c26e37780429b4ed8b87",
                "color": "637A7A",
                "moderationItem": {
                    "lastModifiedTimestamp": "2019-02-03T20:51:00Z",
                    "fieldName": "BACKGROUNDIMAGE",
                    "modifiedByMember": {
                        "onlineId": "Catalinn",
                        "closed": false,
                        "accountId": "6716089449685530145",
                        "role": "owner"
                    },
                    "griefReportable": true
                }
            },
            "broadcastCount": 0,
            "creationTimestamp": "2015-09-30T08:57:42Z",
            "description": "PlayStation",
            "descriptionLastModifiedBy": {
                "lastModifiedTimestamp": "2015-10-01T15:16:34Z",
                "fieldName": "DESCRIPTION",
                "modifiedByMember": {
                    "onlineId": "Catalinn",
                    "closed": false,
                    "accountId": "6716089449685530145",
                    "role": "owner"
                },
                "griefReportable": true
            },
            "griefReportableItems": {
                "name": true,
                "description": true,
                "profileImage": true,
                "backgroundImage": true
            },
            "id": "483876a0-6751-11e5-a4cb-061d9b1a0df3",
            "isCommon": false,
            "language": "ro",
            "members": {
                "size": 822,
                "friendsCount": 0,
                "friends": []
            },
            "name": "PlayStation Fans Romania",
            "nameLastModifiedBy": {
                "lastModifiedTimestamp": "2015-10-02T21:46:20Z",
                "fieldName": "NAME",
                "modifiedByMember": {
                    "onlineId": "Catalinn",
                    "closed": false,
                    "accountId": "6716089449685530145",
                    "role": "owner"
                },
                "griefReportable": true
            },
            "npCountry": "",
            "officialStatus": "unofficial",
            "profileImage": {
                "sourceUrl": "https://satchel-cdn.api.playstation.com/communities/483876a0-6751-11e5-a4cb-061d9b1a0df3/9dc907ec-5615-49e6-91b8-9d038a600634.png",
                "resizeTemplate": "https://image.api.np.km.playstation.net/images/?format=png&image=https%3A%2F%2Fsatchel-cdn.api.playstation.com%2Fcommunities%2F483876a0-6751-11e5-a4cb-061d9b1a0df3%2F9dc907ec-5615-49e6-91b8-9d038a600634.png&sign=821fb6d8a5c05a4c56ceae26cf4f3c5ce2395480",
                "moderationItem": {
                    "lastModifiedTimestamp": "2019-02-03T20:50:19Z",
                    "fieldName": "PROFILEIMAGE",
                    "modifiedByMember": {
                        "onlineId": "Catalinn",
                        "closed": false,
                        "accountId": "6716089449685530145",
                        "role": "owner"
                    },
                    "griefReportable": true
                }
            },
            "role": "member",
            "targetRole": "member",
            "tileBackgroundImage": {
                "sourceUrl": "https://image.api.np.km.playstation.net/images/?format=png&image=https%3A%2F%2Fsatchel-cdn.api.playstation.com%2Fcommunities%2F483876a0-6751-11e5-a4cb-061d9b1a0df3%2F8a652448-58be-442b-b000-143f78602faa.png&sign=bbcdb712207d1aa55b69c26e37780429b4ed8b87&cLeft=415&cTop=405&cWidth=1090&cHeight=270",
                "resizeTemplate": "https://image.api.np.km.playstation.net/images/?format=png&image=https%3A%2F%2Fsatchel-cdn.api.playstation.com%2Fcommunities%2F483876a0-6751-11e5-a4cb-061d9b1a0df3%2F8a652448-58be-442b-b000-143f78602faa.png&sign=bbcdb712207d1aa55b69c26e37780429b4ed8b87&cLeft=415&cTop=405&cWidth=1090&cHeight=270"
            },
            "timezone": "82",
            "titleId": "",
            "type": "open",
            "unreadMessageCount": 11
        },
        {
            "backgroundImage": {
                "sourceUrl": "https://satchel-cdn.api.playstation.com/communities/2892a720-69cd-11e5-bf1c-02be6f0bb56d/45f2c078-2374-4513-b2d2-a368f19dc2a5.jpg",
                "resizeTemplate": "https://image.api.np.km.playstation.net/images/?format=png&image=https%3A%2F%2Fsatchel-cdn.api.playstation.com%2Fcommunities%2F2892a720-69cd-11e5-bf1c-02be6f0bb56d%2F45f2c078-2374-4513-b2d2-a368f19dc2a5.jpg&sign=daa0e5e4bf2e198af5d1d3b541c382a6dff02d62",
                "moderationItem": {
                    "lastModifiedTimestamp": "2015-10-03T13:02:56Z",
                    "fieldName": "BACKGROUNDIMAGE",
                    "modifiedByMember": {
                        "onlineId": "fdkenzo",
                        "closed": false,
                        "accountId": "7348805736810781059",
                        "role": "owner"
                    },
                    "griefReportable": true
                }
            },
            "broadcastCount": 0,
            "creationTimestamp": "2015-10-03T12:51:38Z",
            "description": "Filelist leads, others follow.",
            "descriptionLastModifiedBy": {
                "lastModifiedTimestamp": "2015-10-03T13:02:56Z",
                "fieldName": "DESCRIPTION",
                "modifiedByMember": {
                    "onlineId": "fdkenzo",
                    "closed": false,
                    "accountId": "7348805736810781059",
                    "role": "owner"
                },
                "griefReportable": true
            },
            "griefReportableItems": {
                "name": true,
                "description": true,
                "profileImage": true,
                "backgroundImage": true
            },
            "id": "2892a720-69cd-11e5-bf1c-02be6f0bb56d",
            "isCommon": false,
            "language": "en-GB",
            "members": {
                "size": 195,
                "friendsCount": 0,
                "friends": []
            },
            "name": "Filelist Community",
            "nameLastModifiedBy": {
                "lastModifiedTimestamp": "2015-10-03T13:02:56Z",
                "fieldName": "NAME",
                "modifiedByMember": {
                    "onlineId": "fdkenzo",
                    "closed": false,
                    "accountId": "7348805736810781059",
                    "role": "owner"
                },
                "griefReportable": true
            },
            "npCountry": "",
            "officialStatus": "unofficial",
            "profileImage": {
                "sourceUrl": "https://satchel-cdn.api.playstation.com/communities/2892a720-69cd-11e5-bf1c-02be6f0bb56d/bddf0ad0-3374-495d-a40b-1626c6d06074.jpg",
                "resizeTemplate": "https://image.api.np.km.playstation.net/images/?format=png&image=https%3A%2F%2Fsatchel-cdn.api.playstation.com%2Fcommunities%2F2892a720-69cd-11e5-bf1c-02be6f0bb56d%2Fbddf0ad0-3374-495d-a40b-1626c6d06074.jpg&sign=0deb4c85d207ca551f9b43b91e4a18a4ef357600",
                "moderationItem": {
                    "lastModifiedTimestamp": "2015-10-03T13:02:56Z",
                    "fieldName": "PROFILEIMAGE",
                    "modifiedByMember": {
                        "onlineId": "fdkenzo",
                        "closed": false,
                        "accountId": "7348805736810781059",
                        "role": "owner"
                    },
                    "griefReportable": true
                }
            },
            "role": "member",
            "targetRole": "member",
            "tileBackgroundImage": {
                "sourceUrl": "https://image.api.np.km.playstation.net/images/?format=png&image=https%3A%2F%2Fsatchel-cdn.api.playstation.com%2Fcommunities%2F2892a720-69cd-11e5-bf1c-02be6f0bb56d%2F45f2c078-2374-4513-b2d2-a368f19dc2a5.jpg&sign=daa0e5e4bf2e198af5d1d3b541c382a6dff02d62&cLeft=415&cTop=405&cWidth=1090&cHeight=270",
                "resizeTemplate": "https://image.api.np.km.playstation.net/images/?format=png&image=https%3A%2F%2Fsatchel-cdn.api.playstation.com%2Fcommunities%2F2892a720-69cd-11e5-bf1c-02be6f0bb56d%2F45f2c078-2374-4513-b2d2-a368f19dc2a5.jpg&sign=daa0e5e4bf2e198af5d1d3b541c382a6dff02d62&cLeft=415&cTop=405&cWidth=1090&cHeight=270"
            },
            "timezone": "82",
            "titleId": "",
            "type": "open",
            "unreadMessageCount": 11
        },
        {
            "backgroundImage": {
                "sourceUrl": "https://satchel-cdn.api.playstation.com/communities/083015a0-e9f0-11e5-8ab5-024095ad2d83/ff8e1aa5-2f56-477b-96c1-8bd329899e41.jpg",
                "resizeTemplate": "https://image.api.np.km.playstation.net/images/?format=png&image=https%3A%2F%2Fsatchel-cdn.api.playstation.com%2Fcommunities%2F083015a0-e9f0-11e5-8ab5-024095ad2d83%2Fff8e1aa5-2f56-477b-96c1-8bd329899e41.jpg&sign=3d407bcc28fa570019bd3c01cd217d081fbfc7e6",
                "moderationItem": {
                    "lastModifiedTimestamp": "2016-03-14T15:20:51Z",
                    "fieldName": "BACKGROUNDIMAGE",
                    "modifiedByMember": {
                        "onlineId": "paxlux98",
                        "closed": false,
                        "accountId": "4591085537038109125",
                        "role": "owner"
                    },
                    "griefReportable": true
                }
            },
            "broadcastCount": 0,
            "creationTimestamp": "2016-03-14T14:22:31Z",
            "griefReportableItems": {
                "name": true,
                "description": false,
                "profileImage": true,
                "backgroundImage": true
            },
            "id": "083015a0-e9f0-11e5-8ab5-024095ad2d83",
            "isCommon": false,
            "language": "",
            "members": {
                "size": 31,
                "friendsCount": 0,
                "friends": []
            },
            "name": "Rocket league EuropeanCommunity",
            "nameLastModifiedBy": {
                "lastModifiedTimestamp": "2016-03-14T15:27:03Z",
                "fieldName": "NAME",
                "modifiedByMember": {
                    "onlineId": "paxlux98",
                    "closed": false,
                    "accountId": "4591085537038109125",
                    "role": "owner"
                },
                "griefReportable": true
            },
            "officialStatus": "unofficial",
            "profileImage": {
                "sourceUrl": "https://satchel-cdn.api.playstation.com/communities/083015a0-e9f0-11e5-8ab5-024095ad2d83/0ba98dec-40f4-4b52-b423-0919a8def522.jpg",
                "resizeTemplate": "https://image.api.np.km.playstation.net/images/?format=png&image=https%3A%2F%2Fsatchel-cdn.api.playstation.com%2Fcommunities%2F083015a0-e9f0-11e5-8ab5-024095ad2d83%2F0ba98dec-40f4-4b52-b423-0919a8def522.jpg&sign=94d50dbedba65cd340a0f2276059080c43f2a9d7",
                "moderationItem": {
                    "lastModifiedTimestamp": "2016-03-14T15:21:08Z",
                    "fieldName": "PROFILEIMAGE",
                    "modifiedByMember": {
                        "onlineId": "paxlux98",
                        "closed": false,
                        "accountId": "4591085537038109125",
                        "role": "owner"
                    },
                    "griefReportable": true
                }
            },
            "role": "member",
            "targetRole": "member",
            "tileBackgroundImage": {
                "sourceUrl": "https://image.api.np.km.playstation.net/images/?format=png&image=https%3A%2F%2Fsatchel-cdn.api.playstation.com%2Fcommunities%2F083015a0-e9f0-11e5-8ab5-024095ad2d83%2Fff8e1aa5-2f56-477b-96c1-8bd329899e41.jpg&sign=3d407bcc28fa570019bd3c01cd217d081fbfc7e6&cLeft=415&cTop=405&cWidth=1090&cHeight=270",
                "resizeTemplate": "https://image.api.np.km.playstation.net/images/?format=png&image=https%3A%2F%2Fsatchel-cdn.api.playstation.com%2Fcommunities%2F083015a0-e9f0-11e5-8ab5-024095ad2d83%2Fff8e1aa5-2f56-477b-96c1-8bd329899e41.jpg&sign=3d407bcc28fa570019bd3c01cd217d081fbfc7e6&cLeft=415&cTop=405&cWidth=1090&cHeight=270"
            },
            "timezone": "",
            "titleId": "CUSA01433_00",
            "titleImage": {
                "sourceUrl": "http://gs2-sec.ww.prod.dl.playstation.net/gs2-sec/appkgo/prod/CUSA01433_00/7/i_5c5e430a49994f22df5fd81f446ead7b6ae45027af490b415fe4e744a9918e4c/i/icon0.png",
                "resizeTemplate": "https://image.api.np.km.playstation.net/images/?format=png&image=http%3A%2F%2Fgs2-sec.ww.prod.dl.playstation.net%2Fgs2-sec%2Fappkgo%2Fprod%2FCUSA01433_00%2F7%2Fi_5c5e430a49994f22df5fd81f446ead7b6ae45027af490b415fe4e744a9918e4c%2Fi%2Ficon0.png&sign=473c7df45503a1d318ba8f26b15121afadac9eb7"
            },
            "titleName": "Rocket League®",
            "type": "open",
            "unreadMessageCount": 11
        }
    ],
    "canCreateCommunity": true,
    "maxNumberOfCreatedCommunities": 5,
    "maxUnreadMessageCount": 10
}
BenZero commented 3 years ago

Firstly thanks for your answers , @pacMakaveli how do you avoid the "Client does not have grant type: ["sso_cookie"]" error on the old login method ?

pacMakaveli commented 3 years ago

Nevermind! Looks like I had my credentials cached and the refresh_token was still valid. So, as Tustin said, it looks like the old way of authenticating is now gone. You can still get an access_token if you have a refresh_token. In my case, I was storing this and it's valid, not sure for how long though!

@BenZero let me know what kind of access you need from the old API and I'll try to help you through https://games.directory/api/v1/play_station

Drop me a line at oss@games.directory with your requirements and I can whip out a small API from where you can request data from the old PlayStation API while it still works, using my refresh_token.

Ragowit commented 3 years ago

PS4 Firmware 8.50 is around the corner, public beta is out and it will remove communities from PS4 as well.

https://mp1st.com/news/ps4-beta-update-8-50-rolling-out-for-testers-removes-psn-communities

stale[bot] commented 3 years ago

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.