COMING SOON
Focus on your game and quit rolling your own user authentication.
If you've been thinking about implementing OAuth, don't bother. It is way too complicated and doesn't meet the needs of a casual game anyhow.
We provide exactly what you need, no more, no less, and it's braindead easy to use. And we provide all the nuisance functionality to manage things like forgot password, logout, and verifying the account with either email or text message.
In your game's javascript simply call our authUser() method with no parameters (although you may optionally supply a config object). This method will return a JSON object with the user's information if the user is logged in, or an error message if not.
<script src="https://www.gexhub.net/js/gex.min.js"></script>
let res = GEX.authUser();
if(res.status == "ok") {
alert(`Welcome ${res.username}`);
}
else {
alert(`Login failed: ${res.message}`);
}
It's that easy.
{
"status": "ok" || "error",
"message": "error message if status is error, otherwise a simple confirmation message",
"data": {
"username": "val", // the user's chosen nickname, guaranteed unique
"authkey": "text" // the user's unique authkey, constant, may be used to identify the user in future calls
"sessionkey": "text" // the user's unique sessionkey, valid until the user logs out
// or logs in from somewhere else starting a new session
"code": "int" // the user's unique code, constant but guessable
"lastLoginTime": "datetime", // the timestamp of the user's last login
"anonymous": "bool", // true if the user is logged in anonymously, false if the user has a registered account
}
}
The data fields identifying the user are not valid unless the status is "ok".
You may pass an optional config object to the GEX.authUser() function. The config object may contain the following fields:
config = {
playModes: {
anonymous: true,
private: false,
registered: true
},
name: '',
resetPassword: RESET_PASSWORD_URL
};