Sign In Register

How can we help you today?

Start a new topic
Answered

how can a registration request return invitation code for a player too?

When a player registers in a game,(username,password,displayname) I want to send an invitation code for him/her(who registers)

how can I do that?


Best Answer

Hi Mahd,


You will first need to obtain the user email during the registration. We have a tutorial that is some what similar here: https://docs.gamesparks.com/tutorials/social-authentication-and-player-profile/automating-user-password-change.html


In the RegistrationResponse you could then write a function that generates a random token and then store this token against the player data in privateData in the playerCollection. You could then use something like our sendgrid integration to send that user an email with the token.


Hope this points you in the right direction.

 - Steve


Answer

Hi Mahd,


You will first need to obtain the user email during the registration. We have a tutorial that is some what similar here: https://docs.gamesparks.com/tutorials/social-authentication-and-player-profile/automating-user-password-change.html


In the RegistrationResponse you could then write a function that generates a random token and then store this token against the player data in privateData in the playerCollection. You could then use something like our sendgrid integration to send that user an email with the token.


Hope this points you in the right direction.

 - Steve

Hi Mahd,

You may also return a token directly in the registration response by using Spark.setScriptData();


Kind regards,

 - Steve

Login to post a comment