question

Hector Borges avatar image
Hector Borges asked

Is there a way to execute a CloudScript without being logged in?,Can the Client Execute a cloud Script while not logged in?

Hi, I am trying to set up Account Recovery for Emails by following this tutorial: https://docs.microsoft.com/en-us/gaming/playfab/features/engagement/emails/using-email-templates-to-send-an-account-recovery-email

I am on Step 4. In the SendCustomAccountRecoveryEmail function looking at the line

PlayFabServerAPI.SendCustomAccountRecoveryEmail

Unity does not recognize PlayFabServerAPI. I know I can fix this by going to the PlayFab Editor Extension tab in Unity and enabling the ServerAPI but I read that if I do this I end up exposing the DeveloperSecretKey which would cause some very serious security issues and render the application unreleasable.

I also read that CloudScripts have access to the Server API so my solution was to create a CloudScript that would call the PlayFabServerAPI.SendCustomAccountRecoveryEmail instead so that I don't have to enable the ServerAPI to circumvent the security issues.

Unfortunately, when I went to execute the CloudScript in Unity I got an error stating that the client must be logged in to execute a CloudScript. This is a problem because I'm trying to send a Recovery Email meaning the user is not logged in.

My question is, Is there a way to execute a CloudScript without being logged in? or Am I doing this the wrong way and is there a different way I should go about it?

Thank You for your time!

,

I'm trying to implement an Email Recovery system using this tutorial: https://docs.microsoft.com/en-us/gaming/playfab/features/engagement/emails/using-email-templates-to-send-an-account-recovery-email

I am on Step 4. I'm stuck on the part In the SendCustomAccountRecoveryEmail function where we run the PlayFabServerAPI.SendCustomAccountRecoveryEmail call.

The PlayFabServerAPI is not recognized so I can not make this call. I can always go to the PlayFab Editor Extension tab in Unity and Enable the Server API but I read that this exposes the DeveloperSecretKey which brings with it some serious security issues so that is not an option.

I read that CloudScripts have access to the ServerAPI functionality and so I thought I could execute the Code in Part 4 of the tutorial in a CloudScript and just execute the CloudScript from the client side.

What ended up happening is that I got an error that states that a client can not execute a CloudScript while not logged in. Which because the user is trying to reset their password, they would not be logged in.

So my question is, is there a way to Execute a CloudScript without being logged in? Or am I just doing this wrong and if so is there a better way to do it?

CloudScript
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Sarah Zhang avatar image
Sarah Zhang answered

For this situation, you can directly call the client API SendAccountRecoveryEmail in the clients. Players do not need to log in before they call this API. This Client API method is designed for such uses as resetting passwords.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.