Пример #1
0
    /// <summary>
    /// Authenticates with the PlayFab backend & obtains an entity token for the title.
    /// </summary>
    /// <returns>
    /// Boolean representing whether the call was successful or not
    /// </returns>
    public async Task <bool> GetTitleEntityToken()
    {
        // Reset our entity token
        m_EntityToken = String.Empty;

        var key = new PlayFab.AuthenticationModels.EntityKey();

        key.Id = PlayFab.PlayFabSettings.TitleId;

        var tokenRequest = new GetEntityTokenRequest();

        tokenRequest.Entity = key;

        // Get an entity token from the PF backend using our title ID
        PlayFabResult <GetEntityTokenResponse> taskResult = await PlayFab.PlayFabAuthenticationAPI.GetEntityTokenAsync(tokenRequest);

        // Check the response for an error
        bool hasError = CheckForError(taskResult);

        if (!hasError)
        {
            m_EntityToken = taskResult.Result.EntityToken;
        }
        else
        {
            m_EntityToken = String.Empty;
        }

        return(!hasError);
    }
Пример #2
0
 private PlayFab.GroupsModels.EntityKey ConvertEntityKey(PlayFab.AuthenticationModels.EntityKey entityKey)
 {
     return(new PlayFab.GroupsModels.EntityKey()
     {
         Id = entityKey.Id, Type = entityKey.Type
     });
 }