0% found this document useful (0 votes)
25 views1 page

Better Auth

The document outlines a function for authenticating users based on their PlayFab ID and custom ID information. If the user is invalid or has an incorrect custom ID format, they are banned and deleted from the server, with a notification sent to a specified webhook. If the user is authorized, their status is returned along with their custom ID and organization scope information.

Uploaded by

millardkareem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views1 page

Better Auth

The document outlines a function for authenticating users based on their PlayFab ID and custom ID information. If the user is invalid or has an incorrect custom ID format, they are banned and deleted from the server, with a notification sent to a specified webhook. If the user is authorized, their status is returned along with their custom ID and organization scope information.

Uploaded by

millardkareem
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

handlers.

BetterAuthenticator = function(args) {
var getUserInforesult =
server.GetUserAccountInfo({PlayFabId:currentPlayerId}).UserInfo;
if (!getUserInforesult.ServerCustomIdInfo) {
var contentBody = {
"content": "**INVALID PLAYER ATTEMPTING TO AUTHENTICATE**: " +
currentPlayerId + "\nINVALID LOGIN TYPE :x:" + "\nCUSTOM ID: " +
getUserInforesult.ServerCustomIdInfo.CustomId
};
var url = ""; //webhook url here
var method = "post";
var contentType = "application/json";
var headers = {};
var responseString = http.request(url, method, JSON.stringify(contentBody),
contentType, headers);
server.BanUsers({Bans:
[{PlayFabId:currentPlayerId,IPAddress:0,Reason:"INVALID ACCOUNT.",DurationInHours:
672}]})
server.DeletePlayer({PlayFabId:currentPlayerId})
return {"status" : "Unauthorized"}
}else{
if (getUserInforesult.ServerCustomIdInfo.CustomId.startsWith("OCULUS")) {
if (getUserInforesult.ServerCustomIdInfo.CustomId.substring(6).length
== 16 || getUserInforesult.ServerCustomIdInfo.CustomId.substring(6).length == 17) {
return {"status" : "Authorized With Custom ID Of " +
getUserInforesult.ServerCustomIdInfo.CustomId + " and the org scope of " +
getUserInforesult.ServerCustomIdInfo.CustomId.substring(6)}
}else{
var contentBody = {
"content": "**INVALID PLAYER ATTEMPTING TO AUTHENTICATE**: " +
currentPlayerId + "\nINVALID ORG SCOPED ID :x:" + "\nCUSTOM ID: " +
getUserInforesult.ServerCustomIdInfo.CustomId
};
var url = ""; //webhook url here
var method = "post";
var contentType = "application/json";
var headers = {};
var responseString = http.request(url, method,
JSON.stringify(contentBody), contentType, headers);
server.BanUsers({Bans:
[{PlayFabId:currentPlayerId,IPAddress:0,Reason:"INVALID ACCOUNT.",DurationInHours:
672}]})
server.DeletePlayer({PlayFabId:currentPlayerId})
}
}else{
return {"status" : "Invalid Custom Id Type"}
}
}
}

You might also like