Users accounts API initially inspired by Stormpath.
See http://docs.stormpath.com/rest/product-guide/#application-accounts when in doubt about a parameter.
All users data used to be stored in Stormpath a while back. With Stormpath rolling out after being acquired, we migrated our user accounts to ganomede-directory (our own solution). During the migration period, there were users in both user directories, the server includes some logic to make this possible.
With the stormpath API being discontinued, we removed the code that makes use of it. As a side effect, the server still allows multiple user accounts backends to be used, but effectively it only supports a single one: ganomede-directory.
Link with the ganomede-directory service:
DIRECTORY_PORT_8000_TCP_[ADDR|PORT|PROTOCOL] - IP|port|protocol of the directory serviceLink with a central and local usermeta services. Note that central metadata are shared across multiple apps, while local metadata are only used by this game server.
CENTRAL_USERMETA_PORT_8000_TCP_[ADDR|PORT|PROTOCOL] - IP|port|protocol of the central usermeta serviceLOCAL_USERMETA_PORT_8000_TCP_[ADDR|PORT|PROTOCOL] - IP|port|protocol of the local usermeta serviceLink with the events service, used to send notification when a user logs in, registers a new account, changes their profile or block another user.
EVENTS_PORT_8000_TCP_[ADDR|PORT|PROTOCOL] - IP|port|protocol of the events serviceLink with the facebook API.
FACEBOOK_APP_ID - Id of the Facebook applicationFACEBOOK_APP_SECRET - Secret of the Facebook applicationLink with apple (for Sign In with Apple).
IOS_BUNDLE_ID - The bundle identifier of the ios application.Config:
LEGACY_ERROR_CODES - Use stormpath compatible error codes.LOG_LEVEL - See bunyan levels (default: info)AUDIT_REQUESTS - Set to force to audit all requests.Mailer options (for password reset emails)
MAILER_SEND_FROM - Sender of password reset emailMAILER_SEND_SUBJECT - Subject of password reset emailMAILER_SEND_TEXT - Plain text of password reset emailMAILER_SEND_HTML - HTML text of password reset emailMAILER_PORT - the port to connect to (defaults to 25 or 465)MAILER_HOST - the hostname or IP address to connect to (defaults to 'localhost')MAILER_SECURE - connection should use SSL (if true) or not (if false)MAILER_AUTH_USER - username to use when connecting to smtp serverMAILER_AUTH_PASS - password to use when connecting to smtp serverMAILER_IGNORE_TLS - turns off STARTTLS support if trueMAILER_NAME - optional hostname of the client, used for identifying to the serverMAILER_LOCAL_ADDRESS - the local interface to bind to for network connectionsMAILER_CONNECTION_TIMEOUT - how many milliseconds to wait for the connection to establishMAILER_GREETING_TIMEOUT - how many milliseconds to wait for the greeting after connection is establishedMAILER_SOCKET_TIMEOUT - how many milliseconds of inactivity to allowMAILER_DEBUG - set to true, then logs SMTP traffic, otherwise logs only transaction eventsMAILER_AUTH_METHOD - defines preferred authentication method, eg. 'PLAIN'NO_EMAIL_DOMAIN - fake domain to use for users without an email address (default "email-not-provided.local")GUEST_EMAIL_DOMAIN - domain used for guest users email address (default none)Statsd options (used for monitoring).
STATSD_HOST - host that runs the statsd serverSTATSD_PORT - port to connect to statsd serverSTATSD_PREFIX - prefix for data stored in stats (default to ganomede.users.){
"username": "tk421",
"email": "[email protected]",
"password": "Changeme1",
"metadata": {
"newsletter": "false",
"location": "Dublin, Ireland",
"country": "fr",
"birth": "1991"
}
}
{
token: 'rAnDoM'
}
{
"facebookToken": "AccessTokenFromFacebook",
"username": "tk421"
}
{
"token": "rAnDoM"
}
{
"username": "tk421"
}
Create an authentication token.
{
"username": "tk421",
"password": "0000"
}
Note, tag instead of username also work (this allows mispellings).
{
"facebookToken": "AccessTokenFromFacebook"
}
{
"appleId": "123132.312312.312",
"appleIdentityToken": "Base64Encoded IdentityToken from Apple",
"appleAuthorizationCode": "Authorization Code from Apple"
}
Optionally, you can also include the user email, givenName and surname. An username and password to use
if the user doesn't exists, so it can be registered automatically.
{
"token": "0123456789abcdef012345"
}
username will also be included in the response for Facebook and Apple login.
Custom data associated with users.
Additionnally to the custom metadata you can define, ganomede-users also exposes some predefined virtual metadata:
username - unique and constant identifier for the username - unique display name, that might changetag - tagized(name), see the ganomede tagizeremail - (only through /auth/* requests)Users' protected custom data.
{
"key": "some-key",
"value": "..."
}
Change users' custom data.
{
"value": "..."
}
(limited to 200 bytes)
Users' custom data, retrieved using the users tag.
Searching by tag will match any username, name (or similar looking name) the user ever had.
{
"key": "some-key",
"value": "..."
}
List of friends
[ "jeko", "sousou", "willy" ]
[ "harry", "potter" ]
[ "jeko", "sousou", "willy", "harry", "potter" ]
/users/v1/banned-users//users/v1/banned-users/:tag [GET]Returns BanInfo object describing account standing of :tag.
{ "username": "alice", // Username
"exists": true, // true if banned, false otherwise
"createdAt": 1476531925454 // timestamp of ban creation, 0 if no ban.
}
/users/v1/banned-users/ [POST]{
"username": "who-to-ban",
"apiSecret": "process.env.API_SECRET"
}
Ban created successfully.
Invalid or missing API secret.
/users/v1/banned-users/:tag [DELETE]{ "apiSecret": "process.env.API_SECRET" }
Ban removed successfully or does not exist.
Invalid or missing API secret.
/users/v1/auth/:token/blocked-usersA list of blocked users for user identified by the authentication token :token.
The list will be stored in the central usermeta, with key $blocked-users. The value will be an array of strings containing the usernames of blocked users.
For administration purposes, blocked user will also be stored in a ganomede-events channel (users/v1/blocked-users). This way, it becomes possible to analyze recently blocked users and generate daily reports.
/users/v1/auth/:token/blocked-users [GET]Returns the list of blocked users.
[ "bob", "marc" ]
/users/v1/auth/:token/blocked-users [POST]Adds a user to the "blocked-users" list.
{ "username": "who-to-block" }
Blocked user added successfully, returns the new list of blocked users.
[ "who-to-block", "bob", "marc" ]
User already blocked.
Invalid authentication token.
/users/v1/auth/:token/blocked-users/:tag [DELETE]Empty.
Blocked user removed successfully or does not exist.
Invalid authentication token.
/users/v1/admin/:api-secret/blocked-usersEndpoint used by administrators to find annoying users.
/users/v1/admin/:api-secret/blocked-users [GET]You can add a number of filters:
| parameter | type | description |
|---|---|---|
username | string[] | comma separated list of users you're interested in |
since | timestamp | only return users blocked since the provided timestamp |
{
"blocked": [{
"username": "alice",
"total": 2,
"by": [{
"username": "bob",
"createdAt": 1476531925454
}, {
"username": "marco",
"createdAt": 1576531925454
}],
}, {
"username": "bob",
"total": 1,
"by": [{
"username": "harry",
"createdAt": 1376531925454
}],
}]
}
Content type
Image
Digest
sha256:e5eed9bd9…
Size
398.2 MB
Last updated
over 5 years ago
docker pull ganomede/users