Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]

Integrating Corona, Playfab and Photon
Started by renaut.el Mar 14 2019 04:03 AM

No replies to this topic
This topic has been archived. This means that you cannot reply to this topic.
[TOPIC: post.html]


[GLOBAL: userInfoPane.html]
  • Observer

  • 1 posts
  • Corona SDK

Hi guys,

I am currently trying to create a simple turn by turn multiplayer game (slow speed).

The game has been developed in mono player mode with Corona.

I have decided to use Playfab to manage my players and photon for the matchmaking/room management.

Unfortunately there are very very few examples of code with these three services working together.


My code works fine up to know, I can login to playfab with CustomId and generate a call to get a photonToken, I receive the photon token, but then I don't know what to do with it.

My understanding is that I can now call Cloudscripts on the playfab side to OpenRoom. My Webhooks are set up and ready for that but I have no clue how to write the scripts correctly and can't find any examples. Anybody could help me on that ?


Thanks, philippe

local loginRequest = {
        -- https://api.playfab.com/documentation/Client/method/LoginWithCustomID
        CustomId = "Test",
        CreateAccount = true

local PhotonAuthenticationToken={
    PhotonApplicationId = "my-photon-id-is-here"

local PlayFabId=""
local function AuthenticateWithPhoton(result)
  print("Photon token acquired: "..result.PhotonCustomAuthenticationToken.."  Authentication complete.");

local customAuth={}
        --We add "username" parameter. Do not let it confuse you: PlayFab is expecting this parameter to contain player PlayFab ID (!) and not username.
        --We add "token" parameter. PlayFab expects it to contain Photon Authentication Token issues to your during previous step.


local function RequestPhotonToken (result)
  print("LOGIN :"..result.PlayFabId)
  print("PlayFab authenticated. Requesting photon token...");
  PlayFabClientApi.GetPhotonAuthenticationToken(PhotonAuthenticationToken, AuthenticateWithPhoton, function(error) print("Authenticate Photon went wrong") end);

        function(error) print("Something went wrong with your first API call.\nHere's some debug information:\n" .. error.errorMessage) end