fortnite-php icon indicating copy to clipboard operation
fortnite-php copied to clipboard

See if player is in a game?

Open dzinks2009 opened this issue 6 years ago • 18 comments

Hello, I was wondering if there's a way to see if a player is currently in a game.

dzinks2009 avatar Jul 04 '18 14:07 dzinks2009

Probably not possible, although I never checked. I guess if the Epic client shows that your friends are in a game I guess you might be able to, but I never saw anything like this when reversing everything.

Tustin avatar Jul 04 '18 20:07 Tustin

It'd be pretty cool if that was possible. Are you able to check it? @Tustin

dzinks2009 avatar Jul 06 '18 21:07 dzinks2009

I took a look and it does show when your friends are playing the game, but unfortunately, I didn't see any requests that show that information for some reason. It might be done using web sockets or maybe they use certificate pinning for some Epic Launcher requests like they do with the game. I'll keep checking it out and see if I can find out what's going on with that.

Tustin avatar Jul 10 '18 19:07 Tustin

Anything?

dzinks2009 avatar Aug 03 '18 03:08 dzinks2009

@dzinks2009 After i saw this Issue i found information about player matchmaking, so i think it's possible to find is the player playing or idle in the menu. :)

BulgarianHealer avatar Aug 12 '18 00:08 BulgarianHealer

@Tustin After i start playing game i saw those 3 urls:

https://fortnite-public-service-prod11.ol.epicgames.com/fortnite/api/game/v2/matchmakingservice/ticket/player/821df08eaed64082a2f2e0379dee6402?partyPlayerIds=821df08eaed64082a2f2e0379dee6402&bucketId=4240488%3A0%3ANAE%3Aplaylist_defaultsolo&player.platform=Windows&party.WIN=true&input.KBM=true

https://fortnite-public-service-prod11.ol.epicgames.com/fortnite/api/matchmaking/session/f31ce23e4201430ebed925a98c73d036

https://fortnite-public-service-prod11.ol.epicgames.com/fortnite/api/game/v2/matchmaking/account/821df08eaed64082a2f2e0379dee6402/session/f31ce23e4201430ebed925a98c73d036 

URL: content

1st:
{"serviceUrl":"wss://fortnite-matchmaking-public-service-live-prod-b.ol.epicgames.com:443","ticketType":"mms-player","payload":"eyJwbGF5ZXJJZCI6IjgyMWRmMDhlYWVkNjQwODJhMmYyZTAzNzlkZWU2NDAyIiwicGFydHlQbGF5ZXJJZHMiOlsiODIxZGYwOGVhZWQ2NDA4MmEyZjJlMDM3OWRlZTY0MDIiXSwiYnVja2V0SWQiOiJGTjpMaXZlOjQyNDA0ODg6MDpOQUU6cGxheWxpc3RfZGVmYXVsdHNvbG86UEM6cHVibGljOjEiLCJhdHRyaWJ1dGVzIjp7InBsYXllci5wbGF0Zm9ybSI6IldpbmRvd3MifSwiZXhwaXJlQXQiOiIyMDE4LTA4LTEyVDAwOjIyOjUyLjMxNVoiLCJub25jZSI6InBjWnZEdU9rZDVCdXdGSVhoV0Q3ZVg2M3RscWdyaURzIn0=","signature":"i5AT3tLThC0emedmEuSd6E3gD0hNUpPiPD0ITl+8YT4="}

2nd:
{"id":"f31ce23e4201430ebed925a98c73d036","ownerId":"1ECE124D08D5FFE90E46ED9650E6531D","ownerName":"[DS]fortnite-livenaeaws02c59athena-4266518-1-i-030eb8c823a40a41a-17997","serverName":"[DS]fortnite-livenaeaws02c59athena-4266518-1-i-030eb8c823a40a41a-17997","serverAddress":"34.235.156.75","serverPort":9009,"maxPublicPlayers":112,"openPublicPlayers":12,"maxPrivatePlayers":0,"openPrivatePlayers":0,"attributes":{"REGION_s":"NAE","GAMEMODE_s":"FORTATHENA","DCID_s":"FORTNITE-LIVENAEAWS02C59ATHENA-4266518-1","tenant_s":"Fortnite","MATCHMAKINGPOOL_s":"Any","PLAYLISTID_i":2,"HOTFIXVERSION_i":0,"BEACONPORT_i":15009},"publicPlayers":["703a2862a7b5401f9c32119573250cb4","9e4821edb6de41f4af3d5294a3f8a6ed","0cbec02c2f5c424ca6fdfc2bb1b7b520","972bc4110d764c7588523b37a65e1de9","0adc85b913054bd9beb44daf401ca27c","d49e3f75ad2d42a18a77dadb523a17ee","ad7347c328ee4f87ac18a170304c118f","5b9bd41baeba4503bc25914bb448354d","683aad459e344f60ad6d48193bb66e40","c8ead8610c114a0f9d70498d1179da85","eb23878a266a41dc86c167e8a73dcf57","08ce79177598431eaf4af4f0cc18a2e2","e08fa49f0bfc4962b43617fbceafa7f6","0032f757b400467e80a2beb5f9f8be7f","d92057225775423bb7dc5e05c2d8652c","503b9eaf656940f599f13fd535f6934b","ff783fc128b34092a7b0fbf7d70432af","419bdcd653094ba980d74e3685dfca06","046667b832c74a37a460e286d5b4ea50","7c7937ff50084eb89e8e2ba8facd5160","821df08eaed64082a2f2e0379dee6402","94521aadd37c4b329eed0b0f80278338","7f0b84a97cf7414f8c013ba6ff9e3a9d","219708517795495d972e784e522f57f8","9caf348bd75642b483c2c715c91c56b8","a8606fd6b90b4f3db2e50aee01cad5f8","ac4add0f1f684bd889160abb6ce37ce8","7e0da7527dd74dffb75481bd054b67ca","5039269743a049a0958592aecfd13478","4e77b403ce5e4cc8adfb050103fb159f","c8694161a6c9426d9998dee410b44bf2","2e3eb3ff18774752b3a3e9177906cd62","aed84ff9f4294b2c947b13b000eaccfc","282671c8e1064a8c9c2db8b05ce0401f","8a45e6dd265a46bfba36c161b2bad4e9","e1795666a910432592f2abd7c61425bd","11ea136dabe14a7f9c8a6d5bce0fac7d","128e092f46f0443bbd3b2fee1a505f28","6d4b915201ce4926a4f0baa8696769f1","6168fa307338401e99a65a0ba9e867a2","0e7d40465fb64dfb91091dcc7038a349","7cd5c7470f084b848bfa3e5661f7f5cb","c27b8aaf88994ccb9ebe513e07d085cc","94bcb105a1ea4909b3ec37b398f21dfd","489b3bd8f48c46dda67e9e32ea13d785","6dcc894a9f114daeb780660bc38eb2bd","0ba2df93abda436b9d3de6a3441cfe77","830c9a79f9754ebfb6b37f48f7fe3a23","a0f143f28cde43bb8c361a74f19e6904","1674ac33949f4404b8bdd363034c6d6e","6f3525336fda4513b52fd6116ce2a3b6","7840ecdcfae648028eceee86a6985001","d41640bb719145b482ea61b86f77a5f4","fa6ddbd01be24a588f7a4819a2bdd976","18a25fd1518043fc914eb9aa70eb79ea","c75d3e44897f460a98f531b47a420846","1f686033c0364e4c8d9ba30940c748a8","e6dac68201ce44fd8b2519f86ae930e1","89b57079cfa840d98cb73a5be128b722","970c1017f3964ad4833b3f80d385f90f","8b23d05a17ea4dcf85290fe4c9749d58","ec4474851a6a4459a4c5c9a1a4806561","b1b6b2327a4d414a8f692d37c6949dd2","bce99e4adeb847169ab0a6ef357d444c","6a8f769f680e400aa95cc0d8de12c02d","3fa985d8a5834ef4b8b02b7df816724f","6a2d824412e74ecebb60a1a0de21ff9e","89285596b41b468aa747eed33a17d85a","e4ff614bfdc14bdca212d6e996a87b61","5104f700dcda42bca02be3a31a1bc331","58f02c7d45694b8f8a94bd77f534d074","4228fb9322ee440799a85b6bde7bf2d6","c244b70587844f5fb76e9d04f887aaed","803d2c9ea8824049903d6f62b88b62d1","93fbd8a9c0ce48dfb5c0dd772e7cd48f","17493b5c7b1440a8a786c59b074ab633","b5628458c00e4e789f417b84a3e0f866","f1c1a5b6308640c488b71f2be7d33a3d","e44485b9f40d4c88af043d1164917bb9","cf1b415a08f9455fb2fb900fd7ee2816","6dae5be6a9474bc796312f03e725157c","88473c31e375416ea2aa0ff70d211c6a","7b978a262c4d45419cce1ad36ce4b3e7","a048b108c06b446cbc6a5b2d6d09c6af","5a6c333de9dd47008483ff591de98e72","9201e1e8edca4f018a6a115d427ff57e","47e7cdb1d8ce4f8498ee9ed69293e26d","b4fd35ced7484250b5a994008267e8dc","af5edfb6932c49348100b2c8ab468316","7f1c2381ef6d40b2bfb4024c5e1895a7","64ee16c486b146aca9348d1667e77ffc","4042d898f7214d55b99baf3690101d41","5df30f6af1534ccda08f25e3769da4e6","7d523a44f58846e9a8db982379bd2eba","27c7f99352ab4e2b889a86fc9498a484","7d7710e00cb744d38b0d13b6eee2b9b2","978e9fdd64a4456e9023833afe5e50d0","8cfa93abf35c4941859eeb52de37f74e","0db5ae2138b9420a9c7f16db7b327bba","f52a0999ddb947bdb7ff06504592b936"],"privatePlayers":[],"totalPlayers":100,"allowJoinInProgress":true,"shouldAdvertise":false,"isDedicated":false,"usesStats":false,"allowInvites":true,"usesPresence":false,"allowJoinViaPresence":true,"allowJoinViaPresenceFriendsOnly":false,"buildUniqueId":"4240488","lastUpdated":"2018-08-12T00:21:58.746Z","started":false}

3rd:
{"accountId":"821df08eaed64082a2f2e0379dee6402","sessionId":"f31ce23e4201430ebed925a98c73d036","key":"vMKqeUvpk64YlS5O2WMJ9+g5SRL45d7wxsBXx14MTQw="}

1st url i can't get what information is in the payload. 2nd url is the matchmaking server with a lot of information. 3rd url content is interesting, there is sessionId which is used in 2-nd url.

But for now i can't see where is the user status. 😄

BulgarianHealer avatar Aug 12 '18 00:08 BulgarianHealer

They have a friends API, but the best we can get is the list of friends with data like:

    {
        "accountId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
        "created": "2018-08-26T20:23:02.829Z",
        "direction": "INBOUND",
        "favorite": false,
        "status": "ACCEPTED"
    }

By the look of it, the rest of the friend system & chat is handled by some sort of (customized?) xmpp client, in-game. That's how they get the friend list with their status, and that explains why it doesn't show up as regular https request.

Adding/removing friends seem to go through HTTPS though, not sure if that's really useful to anyone.

@Krokit I came across the same call yesterday, I think they use secured web-socket to do the in-game communication with the server. Additionally, they regularly send https requests to give updates & stats (at the end as well) -- pretty interesting stuff

Edit: found a confirmation about the usage of XMPP for the chat: https://www.epicgames.com/fortnite/en-US/news/postmortem-of-service-outage-at-3-4sm-ccu?sessionInvalidated=true

QuentinBellus avatar Sep 03 '18 15:09 QuentinBellus

Hello, basically I'm trying to for my users to add their accounts into my platform and then a cron on my server would be executed every 3min(?) but then when I'm trying to refresh my data with the refresh token, I get this error

PHP Notice:  Undefined property: stdClass::$access_token in /var/www/third_party/fortnite-api/vendor/tustin/fortnite-php/src/Auth.php on line 121
PHP Fatal error:  Uncaught Exception: Unable to unpack offline token: Invalid serialized unsecured/JWS/JWE object: Missing second delimiter in /var/www/third_party/fortnite-api/vendor/tustin/fortnite-php/src/Auth.php:122
Stack trace:
#0 /home/cron/fortnite.php(14): Fortnite\Auth::refresh('eg1~eyJraWQiOiJ...')
#1 {main}
  thrown in /var/www/third_party/fortnite-api/vendor/tustin/fortnite-php/src/Auth.php on line 122

Also, I use the refresh function from Auth.

dzinks2009 avatar Sep 25 '18 02:09 dzinks2009

How is that relevant to the issue @dzinks2009 ?

monkeydioude avatar Sep 25 '18 12:09 monkeydioude

Well, I guess there was no point of creating a new issue but I probably should of done that. Thanks @monkeydioude

dzinks2009 avatar Sep 25 '18 19:09 dzinks2009

Do you happen to know the XMPP port that it sits on? @QuentinBellus I'm in the middle of developing a tool that I'd be happy to go into more details on Discord if you add me. But I want to be able to see when a friend has joined a game and can't for the life of me find any endpoints for it. XMPP usually sits on port 5222 but I am not getting anything on that port from XMPP.

JaydenMaalouf avatar Oct 17 '18 11:10 JaydenMaalouf

@JaydenMaalouf I didn't look into this at all, it's mostly based on information I found here and there. They seem to use XMPP for matchmaking and global chat -- even though nowadays the matchmaking service seems to be a WSS.

I will take a more in-depth look, see if I can find any endpoint. I'll message you for discord.

QuentinBellus avatar Oct 17 '18 13:10 QuentinBellus

@JaydenMaalouf xmpp-service-prod.ol.epicgames.com Port 5222 is open, I didn't run any test yet though I don't have the time for it yet.

QuentinBellus avatar Oct 17 '18 14:10 QuentinBellus

@QuentinBellus Add me Kanga#8041. Will be easier to discuss!

JaydenMaalouf avatar Oct 17 '18 17:10 JaydenMaalouf

Hey @QuentinBellus @JaydenMaalouf , I'm also very interested in this; did your research produce any results? :)

bassner avatar Oct 24 '18 20:10 bassner

Hey @QuentinBellus @JaydenMaalouf. Have you been able to obtain any results and if so would you be so kind to either leave a comment here or hit me up on discord (terbau#8523). Very sorry for a late comment but since the issue is still open I thought of it as ok.

Terbau avatar Jan 15 '19 18:01 Terbau

I just had a quick look in October, couldn't figure out how to connect to their XMPP server to get the players status.

QuentinBellus avatar Jan 15 '19 20:01 QuentinBellus

Don't know if this is still relevant, but the payload from @Krokit 's original request is:

{"playerId":"821df08eaed64082a2f2e0379dee6402","partyPlayerIds":["821df08eaed64082a2f2e0379dee6402"],"bucketId":"FN:Live:4240488:0:NAE:playlist_defaultsolo:PC:public:1","attributes":{"player.platform":"Windows"},"expireAt":"2018-08-12T00:22:52.315Z","nonce":"pcZvDuOkd5BuwFIXhWD7eX63tlqgriDs"}

The payload is base64, to decode just use: echo "PAYLOAD" | base64 -D

Treblue avatar Apr 05 '19 19:04 Treblue