ballistica icon indicating copy to clipboard operation
ballistica copied to clipboard

Feature Request: Authenticate stats website visitor with Bombsquad v2 account

Open rahulraman0108 opened this issue 2 years ago • 3 comments

Description

The new feature I would like to propose is to expose some API from ballistica.net for requesting authentication of visitors on Bombsquad server stats websites.

Usage scenario

I have a Bombsquad server. I have setup the custom stats website to https://bsstats.domain.com, it also has custom mods with features to let players use their in-game accumulated scores to purchase some in-game effects. eg buy a custom tag which will then show up on my spaz over the name in world purchase tag

Now whenever player visits the stats website https://bsstats.domain.com they currently see a list of players with scores with filter by player name or sorting with scores, etc. What I want to add is option for the player to login to the website with their v2 bombsquad id. With that when player logs in I can show them their own all time game history also I can fetch their custom in-game data like current used tag and purchased items and show it to them. I can also show them their stats from multiple servers that I own and have custom stats on same domain in different paths at once when they are logged in just by querying the stats of my owned servers with their player id, and they can also customize(purchase/throw) their appearance and items viewing their score and stats side by side and save it so they get the new look when they play next time without having to type it all in chat.

Solution

(sorry, since I do not have a template html created so I am using text instead of demonstrating with screenshots) A simple example would be like:

  • On my stats website eg.https://bsstats.domain.com there would be a button login with your bombsquad id.
  • The button on click will open a popup window/new window with some link like https://ballistica.net/authorize_app_v2.
  • In the window player will be asked to login to their v2 account if they are not already and then they will be asked if they want to share their v1_id|v2_id|player_tag with <website_name>.
  • And if player authorize to that, click yes then the ballistica.net will create a session code and send it back to https://bsstats.com/authenticate_bs_v2 with code either in a GET request or a POST request (POST preferably).
  • On my website I will get the code from the POST request then save it in user session/cookies.
  • Now with the code I can make call to https://ballistica.net/query_player_code?code=<my_code> which will return a json document with player data if the code is valid, and if it is invalid or expired it will return error code with error data
  • If my website gets the player data then use that for the player login on website if the code is invalid/expired ask for login again

Additional context

So I am getting back to Bombsquad after a few months after my exams. Last time when the workspace was released on tools.ballistica.net I grabbed my own account with my tag. Now with v2 accounts available to use I have been using them on my game 🎉 , got my own v2 tag. Am super excited for what's coming next and especially the asset-packages in 1.8.

rahulraman0108 avatar Jun 17 '22 04:06 rahulraman0108

This sort of functionality sounds great and should map pretty well to the proxy-login/session stuff I've set up for V2 accounts (similar to how the game can authenticate v2 accounts via a web browser).

My #1 priority is getting 1.7 tested and out the door (at least on Google Play), but please ping me after that to remind me to take a look at this..

efroemling avatar Jun 24 '22 20:06 efroemling

but please ping me after that to remind me to take a look at this..

@efroemling I'm pinging you cause it's really the necessary functional

IvanPragma avatar Oct 27 '22 18:10 IvanPragma

Sounds a lot like implementing OpenID Connect with ballistica.net being the Identity Provider and bsstats.domain.com as a Relying Party. I like it.

dekarl avatar Apr 14 '23 16:04 dekarl