Example #1
0
 internal void InvokeLink(AuthTypes linkType, PlayFabError error = null)
 {
     if (OnPlayFabLink != null)
     {
         OnPlayFabLink.Invoke(linkType, error);
     }
 }
    public void Link(Authtypes authType)
    {
        switch (authType)
        {
        case Authtypes.Google:
            AuthType = authType;
            PlayFabClientAPI.LinkGoogleAccount(new LinkGoogleAccountRequest()
            {
                ServerAuthCode = AuthTicket,
                ForceLink      = ForceLink
            }, (result) => {
                if (OnPlayFabLink != null)
                {
                    OnPlayFabLink.Invoke(authType, null);
                }
            }, (error) => {
                if (OnPlayFabLink != null)
                {
                    OnPlayFabLink.Invoke(authType, error);
                }
            });
            break;

        case Authtypes.Facebook:
            AuthType = authType;
            PlayFabClientAPI.LinkFacebookAccount(new LinkFacebookAccountRequest()
            {
                AccessToken = AuthTicket,
                ForceLink   = ForceLink
            }, (result) => {
                if (OnPlayFabLink != null)
                {
                    OnPlayFabLink.Invoke(authType, null);
                }
            }, (error) => {
                if (OnPlayFabLink != null)
                {
                    OnPlayFabLink.Invoke(authType, error);
                }
            });
            break;
        }
    }
Example #3
0
        /// <summary>
        /// Linking for auth types
        /// </summary>
        /// <param name="authType"></param>
        public void Link(Authtypes authType)
        {
            switch (authType)
            {
            case Authtypes.Google:
                AuthType = authType;
                PlayFabClientAPI.LinkGoogleAccount(new LinkGoogleAccountRequest()
                {
                    ServerAuthCode = AuthTicket,
                    ForceLink      = ForceLink
                }, (result) =>
                {
                    if (OnPlayFabLink != null)
                    {
                        OnPlayFabLink.Invoke(authType, null);
                    }
                }, (error) =>
                {
                    if (OnPlayFabLink != null)
                    {
                        OnPlayFabLink.Invoke(authType, error);
                    }
                });
                break;

            case Authtypes.Facebook:
                AuthType = authType;
                PlayFabClientAPI.LinkFacebookAccount(new LinkFacebookAccountRequest()
                {
                    AccessToken = AuthTicket,
                    ForceLink   = ForceLink
                }, (result) =>
                {
                    if (OnPlayFabLink != null)
                    {
                        OnPlayFabLink.Invoke(authType, null);
                    }
                }, (error) =>
                {
                    if (OnPlayFabLink != null)
                    {
                        OnPlayFabLink.Invoke(authType, error);
                    }
                });
                break;

            case Authtypes.Xbox:
                AuthType = Authtypes.Xbox;
                PlayFabClientAPI.LinkXboxAccount(new LinkXboxAccountRequest()
                {
                    XboxToken = AuthTicket,
                    ForceLink = ForceLink
                }, (result) =>
                {
                    if (OnPlayFabLink != null)
                    {
                        OnPlayFabLink.Invoke(authType, null);
                    }
                }, (error) =>
                {
                    if (OnPlayFabLink != null)
                    {
                        OnPlayFabLink.Invoke(authType, error);
                    }
                });
                break;

            case Authtypes.Steam:
                AuthType = Authtypes.Steam;
                PlayFabClientAPI.LinkSteamAccount(new LinkSteamAccountRequest()
                {
                    SteamTicket = AuthTicket,
                    ForceLink   = ForceLink
                }, (result) =>
                {
                    if (OnPlayFabLink != null)
                    {
                        OnPlayFabLink.Invoke(authType, null);
                    }
                }, (error) =>
                {
                    if (OnPlayFabLink != null)
                    {
                        OnPlayFabLink.Invoke(authType, error);
                    }
                });
                break;

            case Authtypes.PSN:
                //TODO: how do we handle PSN in the sdks?
                //This might need to be generated.
                break;

            case Authtypes.OpenId:
                AuthType = Authtypes.OpenId;

                break;
            }
        }