Hi, I'm using postman to test this API and I'm not sure why I getting this error. What are the steps I need to follow to log in and consume this API?
][1]
Hi, I'm using postman to test this API and I'm not sure why I getting this error. What are the steps I need to follow to log in and consume this API?
][1]
Please note that for security reasons, the Entity Token will expire after a certain period of time. As https://learn.microsoft.com/en-us/gaming/playfab/sdks/postman/postman-quickstart#getting-a-title-entity-token mentions that “Entity tokens expire after 24 hours. Afterwards, you need to re-run GetEntityToken to get a new entity token and update your environment variable”. So, you need to refresh the Entity Token by calling the API GetEntityToken. And after you call it, the token's expiration time will be returned as a property (TokenExpiration) in GetEntityTokenResponse.
Thanks, I got it!
Now, this is the response { "code": 401, "status": "Unauthorized", "error": "NotAuthorized", "errorCode": 1089, "errorMessage": "Only entities of the following types may call this API: title" }
Is there any possibility to login as "title" using postan?
this code allowed me to change the standby value for a particular region.
var PlayFabServer = require("playfab-sdk/Scripts/PlayFab/PlayFabMultiplayer");
var PlayFabAuth = require("playfab-sdk/Scripts/PlayFab/PlayFabAuthentication");
const dotenv = require('dotenv')
dotenv.config({path:'../../config/config.env'});
exports.updateBuildRegion = async function updateBuildRegion() {
return new Promise((resolve, reject) => {
PlayFab.settings.titleId = process.env.PLAYFAB_TITLE_ID;
PlayFab.settings.developerSecretKey = process.env.SECRET_KEY;
var request = {
}
;
PlayFabAuth.GetEntityToken(request, (error, result) => {
if (result !== null) {
var request = {
"BuildId": "xxxxx-1154-xxxx-bc66-xxxxxxxx",
"BuildRegion": {
"Region": "EastUs",
"MaxServers": 1,
"StandbyServers": 0
}
}
;
PlayFabServer.UpdateBuildRegion(request, (error, result) => {
if (result !== null) {
resolve(result); //
} else if (error !== null) {
reject(CompileErrorReport(error)); //
}
});
} else if (error !== null) {
reject(CompileErrorReport(error)); //
}
});
});
};
// This is a utility function we haven't put into the core SDK yet. Feel free to use it.
function CompileErrorReport(error) {
if (error == null)
return "";
var fullErrors = error.errorMessage;
for (var paramName in error.errorDetails)
for (var msgIdx in error.errorDetails[paramName])
fullErrors += "\n" + paramName + ": " + error.errorDetails[paramName][msgIdx];
return JSON.stringify(fullErrors);
}
While I was writing this I found out how to login as "title". I just needed to disable the X-Authorization in the Header
2 People are following this question.