# Integrating Corona, Playfab and Photon

**URL:** <https://forums.solar2d.com/t/integrating-corona-playfab-and-photon/349598>\
**Category:** Game Networking\
**Created:** [March 14, 2019, 12:03pm UTC](https://forums.solar2d.com/t/integrating-corona-playfab-and-photon/349598 "2019-03-14T12:03:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![renaut.el](https://forums.solar2d.com/letter_avatar_proxy/v4/letter/r/3e96dc/32.png) [@renaut.el](https://forums.solar2d.com/u/renaut.el)\
**Post date:** [March 14, 2019, 12:03pm UTC](https://forums.solar2d.com/t/integrating-corona-playfab-and-photon/349598/1 "2019-03-14T12:03:45Z")

</div>

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. customAuth.username=PlayFabId --We add "token" parameter. PlayFab expects it to contain Photon Authentication Token issues to your during previous step. customAuth.token=result.PhotonCustomAuthenticationToken end local function RequestPhotonToken (result) print("LOGIN :"..result.PlayFabId) print("PlayFab authenticated. Requesting photon token..."); PlayFabId=result.PlayFabId PlayFabClientApi.GetPhotonAuthenticationToken(PhotonAuthenticationToken, AuthenticateWithPhoton, function(error) print("Authenticate Photon went wrong") end); end PlayFabClientApi.LoginWithCustomID(loginRequest, RequestPhotonToken, function(error) print("Something went wrong with your first API call.\nHere's some debug information:\n" .. error.errorMessage) end )
```
