Example #1
0
    private void AuthenticateWithPhoton(GetPhotonAuthenticationTokenResult obj)
    {
        LogMessage("Photon token acquired: " + obj.PhotonCustomAuthenticationToken + "  Authentication complete.");

        //We set AuthType to custom, meaning we bring our own, PlayFab authentication procedure.
        var customAuth = new AuthenticationValues {
            AuthType = CustomAuthenticationType.Custom
        };

        //We add "username" parameter. Do not let it confuse you: PlayFab is expecting this parameter to contain player PlayFab ID (!) and not username.
        customAuth.AddAuthParameter("username", PlayFabAuthService.PlayFabId);    // expected by PlayFab custom auth service

        //We add "token" parameter. PlayFab expects it to contain Photon Authentication Token issues to your during previous step.
        customAuth.AddAuthParameter("token", obj.PhotonCustomAuthenticationToken);

        //We finally tell Photon to use this authentication parameters throughout the entire application.
        PhotonNetwork.AuthValues = customAuth;

        if (!PhotonNetwork.IsConnected)
        {
            PhotonNetwork.ConnectUsingSettings();
        }

        PhotonNetwork.LocalPlayer.NickName = (PlayFabAuthService.PlayFabId.Split(new Char[] { '-' }))[0];
        SetLobbyPanelActive();
    }
Example #2
0
    private void OnPhotonTokenReceived(GetPhotonAuthenticationTokenResult result)
    {
        Debug.Log("Received photon token");

        //We set AuthType to custom, meaning we bring our own, PlayFab authentication procedure.
        var customAuth = new AuthenticationValues {
            AuthType = CustomAuthenticationType.Custom
        };

        //We add "username" parameter. Do not let it confuse you: PlayFab is expecting this parameter to contain player PlayFab ID (!) and not username.
        customAuth.AddAuthParameter("username", PlayerId);    // expected by PlayFab custom auth service

        //We add "token" parameter. PlayFab expects it to contain Photon Authentication Token issues to your during previous step.
        customAuth.AddAuthParameter("token", result.PhotonCustomAuthenticationToken);

        //We finally tell Photon to use this authentication parameters throughout the entire application.
        PhotonNetwork.AuthValues = customAuth;

        //Finally we will initialize photon with any custom data
        InitializePhoton();

        if (OnLogin != null)
        {
            OnLogin();
        }
    }
Example #3
0
    /*
     * Step 3
     * This is the final and the simplest step. We create new AuthenticationValues instance.
     * This class describes how to authenticate a players inside Photon environment.
     */
    private static void AuthenticateWithPhoton(GetPhotonAuthenticationTokenResult obj)
    {
        LogMessage("Photon token acquired: " + obj.PhotonCustomAuthenticationToken + "  Authentication complete.");

        //We set AuthType to custom, meaning we bring our own, PlayFab authentication procedure.
        var customAuth = new AuthenticationValues {
            AuthType = CustomAuthenticationType.Custom
        };

        //We add "username" parameter. Do not let it confuse you: PlayFab is expecting this parameter to contain player PlayFab ID (!) and not username.
        customAuth.AddAuthParameter("username", _playFabPlayerIdCache);    // expected by PlayFab custom auth service

        //We add "token" parameter. PlayFab expects it to contain Photon Authentication Token issues to your during previous step.
        customAuth.AddAuthParameter("token", obj.PhotonCustomAuthenticationToken);

        //We finally tell Photon to use this authentication parameters throughout the entire application.
        PhotonNetwork.AuthValues = customAuth;
        //
        PhotonNetwork.AuthValues.UserId = _playFabPlayerIdCache;
        //
        //UnityEngine.SceneManagement.SceneManager.LoadSceneAsync(0);
        PF_Bridge.RaiseCallbackSuccess(string.Empty, PlayFabAPIMethods.GenericLogin, MessageDisplayStyle.none);
        if (OnLoginSuccess != null)
        {
            OnLoginSuccess(string.Format("SUCCESS: {0}", "result.SessionTicket"), MessageDisplayStyle.error);
        }

        Debug.Log("AuthenticateWithPhoton");
    }
Example #4
0
    private void OnPhotonAuthenticationSuccess(GetPhotonAuthenticationTokenResult obj)
    {
        Logger.Verbose("MainPageScript.OnPhotonAuthenticationSuccess");

        // Set the Photon Connection Settings
        // See https://api.playfab.com/docs/using-photon-with-playfab/
        PhotonNetwork.PhotonServerSettings.AppID           = PhotonAppID;
        PhotonNetwork.PhotonServerSettings.HostType        = ServerSettings.HostingOption.PhotonCloud;
        PhotonNetwork.PhotonServerSettings.PreferredRegion = CloudRegionCode.us;
        PhotonNetwork.PhotonServerSettings.Protocol        = ExitGames.Client.Photon.ConnectionProtocol.Udp;

        string authToken = obj.PhotonCustomAuthenticationToken;

        AuthenticationValues customAuth = new AuthenticationValues();

        customAuth.AuthType = CustomAuthenticationType.Custom;
        customAuth.AddAuthParameter("username", PlayFabManager.PlayfabId);    // expected by PlayFab custom auth service
        customAuth.AddAuthParameter("token", authToken);                      // expected by PlayFab custom auth service

        JUMPOptions.GameVersion = AppID;
        JUMPOptions.CustomAuth  = customAuth;

        // Now Activate the JUMP Connection object that will trigger login to Photon.
        JUMPConnectionStatus = JUMPConnectionStatus.Connecting;
        JUMPConnection.gameObject.SetActive(true);
    }
    private void AuthenticateWithPhoton(GetPhotonAuthenticationTokenResult obj)
    {
        LogMessage("Photon token acquired: " + obj.PhotonCustomAuthenticationToken + "  Authentication complete.");
        var customAuth = new AuthenticationValues {
            AuthType = CustomAuthenticationType.Custom
        };

        customAuth.AddAuthParameter("username", _playFabPlayerIdCache);
        customAuth.AddAuthParameter("token", obj.PhotonCustomAuthenticationToken);
        PhotonNetwork.AuthValues = customAuth;
        LoginScene.Instance.LoginClick();
    }
    void OnAuthTokenResult(GetPhotonAuthenticationTokenResult result)
    {
        AuthenticationValues customAuth = new AuthenticationValues();

        customAuth.AuthType = CustomAuthenticationType.Custom;
        customAuth.AddAuthParameter("username", playfabId);
        customAuth.AddAuthParameter("token", result.PhotonCustomAuthenticationToken);

        PhotonNetwork.AuthValues = customAuth;

        PhotonNetwork.ConnectUsingSettings("v0.1d");
    }
Example #7
0
    private void AuthenticateWithPhoton(GetPhotonAuthenticationTokenResult obj)
    {
        Debug.Log("Photon token acquired: " + obj.PhotonCustomAuthenticationToken + "  Authentication complete.");

        Photon.Realtime.AuthenticationValues authValue = new Photon.Realtime.AuthenticationValues();
        authValue.AuthType = Photon.Realtime.CustomAuthenticationType.Custom;
        authValue.AddAuthParameter("username", playFabPlayerIdCache);
        authValue.AddAuthParameter("token", obj.PhotonCustomAuthenticationToken);

        PhotonNetwork.AuthValues = authValue;

        PhotonNetwork.ConnectUsingSettings();
    }
Example #8
0
        private void OnPhotonChatSuccess(GetPhotonAuthenticationTokenResult result)
        {
            // In the C# SDKs, the callbacks are defined in the `IChatClientListener` interface.
            // In the demos, we instantiate and use the ChatClient class to implement the IChatClientListener interface.
            chatClient = new ChatClient(this);
            // Set your favourite region. "EU", "US", and "ASIA" are currently supported.
            var success = chatClient.Connect(PhotonNetwork.PhotonServerSettings.AppSettings.AppIdChat,
                                             PhotonNetwork.AppVersion,
                                             new AuthenticationValues(PlayFabAuthenticationContext.PlayFabId));

            // DontDestroyOnLoad(gameObject);
            Debug.Log($"Connected to chat { success }");
        }
    void AuthenticatewithPhoton(GetPhotonAuthenticationTokenResult result)
    {
        Notify.text = "Photon token acquired Authentication complete.";

        var customAuth = new AuthenticationValues
        {
            AuthType = CustomAuthenticationType.Custom
        };

        customAuth.AddAuthParameter("username", PlayfabId);
        customAuth.AddAuthParameter("token", result.PhotonCustomAuthenticationToken);

        PhotonNetwork.AuthValues = customAuth;

        SceneManager.LoadScene(1);
    }
Example #10
0
    private void GetTokenCallback(GetPhotonAuthenticationTokenResult result)
    {
        // Clean
        errorMessage.text = "";

        string photonToken = result.PhotonCustomAuthenticationToken;

        Debug.Log(string.Format("Yay, logged in in session token: {0}", photonToken));
        PhotonNetwork.AuthValues          = new AuthenticationValues();
        PhotonNetwork.AuthValues.AuthType = CustomAuthenticationType.Custom;
        PhotonNetwork.AuthValues.AddAuthParameter("username", PlayerPersistentData.playerID);
        PhotonNetwork.AuthValues.AddAuthParameter("Token", photonToken);
        PhotonNetwork.ConnectToBestCloudServer("1.0");

        PlayFabClientAPI.GetAccountInfo(new GetAccountInfoRequest {
        }, GetUserData, PlayfabErrorCallback, null);
    }
Example #11
0
    private void AuthenticateWithPhoton(GetPhotonAuthenticationTokenResult obj)
    {
        string gamever = MainMenu.GameVersion;

        gamever = gamever.Replace(".", "_");
        gamever = gamever.Replace(" ", "_");
        Debug.Log("Photon token acquired: " + obj.PhotonCustomAuthenticationToken);
        Debug.Log("Authentication complete playfabID " + _playFabPlayerIdCache);

        //We set AuthType to custom, meaning we bring our own, PlayFab authentication procedure.
        var customAuth = new AuthenticationValues {
            AuthType = CustomAuthenticationType.Custom
        };

        //We add "username" parameter. Do not let it confuse you: PlayFab is expecting this parameter to contain player PlayFab ID (!) and not username.
        customAuth.AddAuthParameter("username", _playFabPlayerIdCache);            // expected by PlayFab custom auth service
        customAuth.UserId = PlayerName;
        //We add "token" parameter. PlayFab expects it to contain Photon Authentication Token issues to your during previous step.
        customAuth.AddAuthParameter("token", obj.PhotonCustomAuthenticationToken);

        //We finally tell Photon to use this authentication parameters throughout the entire application.
        PhotonNetwork.AuthValues = customAuth;

        ZPlayerPrefs.SetString("playfabId", _playFabPlayerIdCache);
        ZPlayerPrefs.SetString("token", obj.PhotonCustomAuthenticationToken);
        ZPlayerPrefs.SetString("username", Email);
        ZPlayerPrefs.SetString("passd", Password);

        PlayerData data = new PlayerData();

        localPlayerDataObject.GetComponent <LocalPlayerData> ().LoadData(data);
        data.name   = Email;
        data.logout = false;
        data.auth   = AuthMethod;
        localPlayerDataObject.GetComponent <LocalPlayerData> ().SaveData(data);

        PlayFabClientAPI.ExecuteCloudScript(new ExecuteCloudScriptRequest()
        {
            FunctionName      = "ClientLogin",
            FunctionParameter = new {
                game_version = gamever
            },
            GeneratePlayStreamEvent = true,
        }, OnCloudScriptSuccess, OnCloudScriptFail
                                            );
    }
Example #12
0
    /*
     * Step 3
     * This is the final and the simplest step. We create new AuthenticationValues instance.
     * This class describes how to authenticate a players inside Photon environment.
     */
    private void AuthenticationWithPhoton(GetPhotonAuthenticationTokenResult _obj)
    {
        LogMessage("Photon token acuired: " + _obj.PhotonCustomAuthenticationToken + " Authentication complete.");

        // We set AuthType to custom, meaning we bring our own, PlayFab authentication procedure.
        var _customAuth = new AuthenticationValues {
            AuthType = CustomAuthenticationType.Custom
        };

        // We add "username" parameter. Do not let it confuse you: PlayFab is expecting this parameter to contain player PlayFab ID(!) and not username.
        _customAuth.AddAuthParameter("username", playFabPlayerIdCache);         // Expected by PlayFab custom auth service

        // We add "token" parameter. PlayFab expects it to contain Photon Authentication Token issue to your during previous step.
        _customAuth.AddAuthParameter("token", _obj.PhotonCustomAuthenticationToken);

        // We finally tell Photon to use this authentication parameters throughout the entire application.
        PhotonNetwork.AuthValues = _customAuth;
    }
Example #13
0
        /*
         * Step 3
         * This is the final and the simplest step. We create new AuthenticationValues instance.
         * This class describes how to authenticate a player inside Photon environment.
         */
        private static void AuthenticateWithPhoton(GetPhotonAuthenticationTokenResult obj)
        {
            Debug.Log("Photon token acquired: " + obj.PhotonCustomAuthenticationToken + "  Authentication complete.");

            //We set AuthType to custom, meaning we bring our own, PlayFab authentication procedure.
            var customAuth = new AuthenticationValues {
                AuthType = CustomAuthenticationType.Custom
            };

            //We add "username" parameter. Do not let it confuse you: PlayFab is expecting this parameter to contain player PlayFab ID (!) and not username.
            customAuth.AddAuthParameter("username", PlayerPrefs.GetString("playFabId"));    // expected by PlayFab custom auth service

            //We add "token" parameter. PlayFab expects it to contain Photon Authentication Token issues to your during previous step.
            customAuth.AddAuthParameter("token", obj.PhotonCustomAuthenticationToken);

            //We finally tell Photon to use this authentication parameters throughout the entire application.
            PhotonNetwork.AuthValues = customAuth;
        }
Example #14
0
    void AuthenticateWithPhoton(GetPhotonAuthenticationTokenResult tokenResult)
    {
        Debug.Log("Photon token acquired: " + tokenResult.PhotonCustomAuthenticationToken + "  Authentication complete.");

        var customAuth = new AuthenticationValues {
            AuthType = CustomAuthenticationType.Custom
        };

        //We add "username" parameter. Do not let it confuse you: PlayFab is expecting this parameter to contain player PlayFab ID (!) and not username.
        customAuth.AddAuthParameter("username", PlayFabId);        // expected by PlayFab custom auth service

        //We add "token" parameter. PlayFab expects it to contain Photon Authentication Token issues to your during previous step.
        customAuth.AddAuthParameter("token", tokenResult.PhotonCustomAuthenticationToken);

        Debug.Log("USerid in custom auth " + customAuth.UserId);
        //We finally tell Photon to use this authentication parameters throughout the entire application.
        PhotonNetwork.AuthValues = customAuth;
        OnGetPhotonAuthenticationTokenResult.OnNext(tokenResult);
        GetPlayerProfile(PlayFabId);
    }
Example #15
0
        private void AuthenticateWithPhoton(GetPhotonAuthenticationTokenResult obj)
        {
            LogMessage("Photon token acquired: " + obj.PhotonCustomAuthenticationToken + "  Authentication complete.");

#if PHOTON_UNITY_NETWORKING
            //We set AuthType to custom, meaning we bring our own, PlayFab authentication procedure.
            var photonAuth = new Photon.Realtime.AuthenticationValues {
                AuthType = Photon.Realtime.CustomAuthenticationType.Custom
            };
            //We add "username" parameter. Do not let it confuse you: PlayFab is expecting this parameter to contain player PlayFab ID (!) and not username.
            photonAuth.AddAuthParameter("username", m_authenticator.Id);    // expected by PlayFab custom auth service

            //We add "token" parameter. PlayFab expects it to contain Photon Authentication Token issues to your during previous step.
            photonAuth.AddAuthParameter("token", obj.PhotonCustomAuthenticationToken);
#endif
            if (m_chatAuthentication)
            {
                var chatController = NetworkingManager.Instance.Chat;
                if (!chatController)
                {
                    return;
                }

                // If using Photon Auth, only have PUNChatProvider
                var provider = chatController.ChatProvider;
#if PHOTON_UNITY_NETWORKING
                if (provider != null && provider is PUNChatProvider punChatProvider)
                {
                    punChatProvider.PhotonCustomAuthenticationToken = obj.PhotonCustomAuthenticationToken;
                    punChatProvider.Authenticate(m_username, m_authenticator.Id);
                }
#endif
            }

#if PHOTON_UNITY_NETWORKING
            photonAuth.UserId = m_username;

            // We finally tell Photon to use this authentication parameters throughout the entire application.
            PhotonNetwork.AuthValues = photonAuth;
#endif
        }
Example #16
0
 void OnPhptonAuthenticationSuccess(GetPhotonAuthenticationTokenResult result)
 {
 }
Example #17
0
    void OnPhotonAuthenticationSuccess(GetPhotonAuthenticationTokenResult result)
    {
        Debug.LogFormat("GetPhotonAuthenticationTokenResult = {0} | {1}", result.CustomData, result.PhotonCustomAuthenticationToken);

//		PhotonNetwork.ConnectToMasterServerWithAuthParams (PlayFabId, result.PhotonCustomAuthenticationToken, PhotonApplicationId, "0.1");
    }
Example #18
0
 // callback on successful GetPhotonAuthenticationToken request
 void OnPhotonAuthenticationSuccess(GetPhotonAuthenticationTokenResult result)
 {
     photonComponent.ConnectToMasterServer(this.playfabId, result.PhotonCustomAuthenticationToken);
 }
Example #19
0
        private void OnSuccess(GetPhotonAuthenticationTokenResult result)
        {
            photonAuthenticationToken.Value = result.PhotonCustomAuthenticationToken;

            Fsm.Event(successEvent);
        }
Example #20
0
 private void OnPhotonAuthenticationSuccess(GetPhotonAuthenticationTokenResult result)
 {
     Debug.Log("Photon Authentication Success");
     ConnectToMasterServer(playfabUserID, result.PhotonCustomAuthenticationToken);
 }
Example #21
0
 void OnPhotonAuthenticationSuccess(GetPhotonAuthenticationTokenResult result)
 {
     Debug.Log("token!");
     playerPhotonToken = result.PhotonCustomAuthenticationToken;
 }
 void OnPhotonAuthenticationSuccess(GetPhotonAuthenticationTokenResult result)
 {
     Debug.Log(result.PhotonCustomAuthenticationToken);
     Debug.Log(AuthManager.playfabId);
     ConnectToMasterServer(AuthManager.playfabId, result.PhotonCustomAuthenticationToken);
 }