I keep having problems changing my cloudscript to azure.
I wrote the azure function and debug it, and it says, "Developer Secret Key must be set in your local or global settings to call this method."
Where can I find the document with this part?
I keep having problems changing my cloudscript to azure.
I wrote the azure function and debug it, and it says, "Developer Secret Key must be set in your local or global settings to call this method."
Where can I find the document with this part?
For this issue, you may need to add Application settings in Azure function. For more info, you can refer to Where to set DeveloperSecretKey for Azure PlayFabServerAPI calls.
using System.Net.Security; using System.Diagnostics; using System; using System.IO; using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.Azure.WebJobs; using Microsoft.Azure.WebJobs.Extensions.Http; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.Logging; using Newtonsoft.Json; using PlayFab.ServerModels; using PlayFab.Json; using PlayFab.DataModels; using PlayFab.Internal; using PlayFab; namespace Company.Function { public static class UpdateSession { [FunctionName("UpdateSession")] public static async Task<IActionResult> Run( [HttpTrigger(AuthorizationLevel.Anonymous, "get", "post", Route = null)] HttpRequest req, ILogger log) { FunctionExecutionContext<dynamic> context = JsonConvert.DeserializeObject<FunctionExecutionContext<dynamic>>(await req.ReadAsStringAsync()); var request = new UpdateUserInternalDataRequest { PlayFabId = context.CallerEntityProfile.Lineage.MasterPlayerAccountId, Data = new Dictionary<string, string>() { {"session", "abc"} } }; var settings = new PlayFabApiSettings { TitleId = context.TitleAuthenticationContext.Id, DeveloperSecretKey = Environment.GetEnvironmentVariable("PLAYFAB_DEV_SECRET_KEY", EnvironmentVariableTarget.Process) }; var authContext = new PlayFabAuthenticationContext { EntityToken = context.TitleAuthenticationContext.EntityToken }; var serverApi = new PlayFabServerInstanceAPI(settings, authContext); var result = await serverApi.UpdateUserInternalDataAsync(request); return new Dictionary<string, string>() { {"test", "test"} }; } } }
9 People are following this question.