Hi everyone,
I want to integrate the Friends API to our game. However, I want to establish a FRIEND relationship directly by using a service account. The documentation reads:
A FRIEND relationship cannot be directly created by a user, but is implicitly created when both users have created FRIEND_REQUEST relationships with each other (i.e. sent and accepted a friend request). A service account or admin user can directly create a FRIEND relationship between specific users.
But trying both calling the REST API with Bearer service token or using the ’
gameApiClient.FriendsRelationshipsApi.CreateRelationshipAsync’ provided in cloud code result in an error:
“swagger validation error”,“message”:“parameter "X-User-Type" in header has an error: value is not one of the allowed values ["PLAYER"]”}]"
I’m a bit confused whether one can establish a friend connection directly using a service acc? The docs don’t mention a service authentication method under ‘Authorization’ in the Reference, but why then is it mentioned to be possible? And why is there FriendsRelationshipsApi in the cloud service when it is not usable?
Best,
Martin
Hi,
Sorry for the late response unfortunately friends does not support service account authentication. The documentation was incorrect and is currently being updated.
The friends API can only be called from players.
Regards,
Patrick
Hi,
Will there be service account support for Friends in the future? I would like to be able to do the following scenario.
- A player generates a friend link.
- The player shares the link with friends.
- When other players open the link, Cloud Code will automatically connect them as friends without the first player need to accept.
Or is this scenario possible in any other way?
Hey,
That does sound like a pretty cool feature can you give me some details on how you see this working, is it a one time use code or is it a link that will always be valid and can auto-approve any user going forward that has the link.
The reason I ask is due to “security” concerns with leaking the code which can be use to spam the user with friends they don’t want.
If it’s one time use then I wonder why not just make a friend request themselves instead of sending a link.
But i’d like to hear more.
Hi,
Some games have this functionality. Monopoly Go is a good example. It’s a single code that can be sent to multiple recipients. When they click the link it will open the game (if they have it installed) and auto-approve/connect the players.
I would guess the link expires after some time and they might have things in place to deal with spamming.
I think this could be a nice feature to have. Either built in to the Friends API or if there was service account support you could implement it yourself in cloud code.
Sorry for the late reply, currently with the features we offer this isn’t possible. We have seen games have a “share” link that links to a site that asks you to download the game, once the game opens it sends a friend request but this still has to be approved by the user who shared the link.