'photon pun2 unity playfab email and password auth

i want to make email auth with playfab and photon istead of custom id auth shown in photon quickstart guide playfab. i tried this script

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Realtime;
using Photon.Pun;
using PlayFab;
using PlayFab.ClientModels;
using TMPro;



public class pfauth : MonoBehaviour
{
    #region objects
    [Header (" register ")]
    public TMP_InputField user;
    public TMP_InputField email;
    public TMP_InputField pass;
    public GameObject regpanel;

    [Header(" login ")]
    public TMP_InputField luser;
    public TMP_InputField lpass;
    public GameObject loginpanel;

    [Header(" Other gameobjects ")]

    public TMP_Text message;
    public bool IsAuthenticated = false;
    public GameObject prpo;
    public float sec;
    private string _playFabPlayerIdCache;

    LoginWithPlayFabRequest loginrequest;
    #endregion

    public void Start() //set the loginpanel as disable at start
    {
        loginpanel.SetActive(false);
        regpanel.SetActive(true);

    }
    public void login()
    {
        loginrequest = new LoginWithPlayFabRequest();
        loginrequest.Username = luser.text;
        loginrequest.Password = lpass.text;
        PlayFabClientAPI.LoginWithPlayFab(loginrequest,  \\in this line how can i call requestphotontoken result => {
            //if account found
            message.text = "welcome back" + user.text + "loging in...";
            StartCoroutine("waitforempty"); //hide the text after few seconds
            IsAuthenticated = true;
            Debug.Log("logged in");
        }, error => {
            message.text = "Sorry! Failed to login(" + error.ErrorMessage + ")";
            StartCoroutine("waitforempty"); //hide the text after few seconds
            Debug.Log(error.ErrorDetails);
            IsAuthenticated = false;

         }, null);
    }

    public void register()
    {
        RegisterPlayFabUserRequest request = new RegisterPlayFabUserRequest();
        request.Email = email.text;
        request.Password = pass.text;
        request.Username = user.text;

        PlayFabClientAPI.RegisterPlayFabUser(request, \\in this line how can i call requestphotontoken result =>
        {
           
            message.text = "Your account has been created!";
            StartCoroutine("waitforempty"); //hide the text after few seconds
            prpo.SetActive(true);
        }, error =>
        {
            message.text = "Sorry! Failed to create your account(" + error.ErrorMessage + ")";
            StartCoroutine("waitforempty"); //hide the text after few seconds
        });

    }

   
   



    public void regpan()
    {
        loginpanel.SetActive(false);
        regpanel.SetActive(true);
    }

    public void logbak()
    {
        loginpanel.SetActive(true);
        regpanel.SetActive(false);
    }

    IEnumerator waitforempty() //hide the text after few seconds
    {
        yield return new WaitForSeconds(sec);
        message.text = " ";

    }

   

   
    private void RequestPhotonToken(LoginResult obj)
    {
        LogMessage("PlayFab authenticated. Requesting photon token...");
        //We can player PlayFabId. This will come in handy during next step
        _playFabPlayerIdCache = obj.PlayFabId;


        PlayFabClientAPI.GetPhotonAuthenticationToken(new GetPhotonAuthenticationTokenRequest()
        {
            PhotonApplicationId = PhotonNetwork.PhotonServerSettings.AppSettings.AppIdRealtime
        }, AuthenticateWithPhoton, OnPlayFabError);
    }


    /*
     * 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 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", "");


        //We finally tell Photon to use this authentication parameters throughout the entire application.
        PhotonNetwork.AuthValues = customAuth;
        Debug.Log(PhotonNetwork.ConnectUsingSettings().ToString());


    }


    private void OnPlayFabError(PlayFabError obj)
    {
        LogMessage(obj.GenerateErrorReport());
    }


    public void LogMessage(string message)
    {
        Debug.Log("PlayFab + Photon Example: " + message);
    }


}

but in the "PlayFabClientAPI.LoginWithPlayFab(loginrequest, \in this line how can i call requestphotontoken" result line in both login and register void when i try to call RequestPhotonToken i shows this error-

Cannot convert methord group to function

please help

Photon PUN 2 Playfab latest



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source