Login
#91
The first version is online: https://github.com/NiLSPACE/Login/tree/networkapi

By default the API is disabled. To enable go to you configuration file and change/add the NetworkAPI.Enabled to true. (Like this, but then Enabled = true
You'll have to come up with some sort of client secret that is at least 10 characters long to prevent misuse of the API. You can also change the port of the API if you want.

To call the API you send JSON to it. The JSON looks like this:
Code:
{
  action: 'APIAction', // Currently only RegisterUser is available.
  playername: 'myplayername', // The name of the player to register
  password: 'MyPassword', // The password that you want the user to have
}

In PHP it looks somewhat like this:
PHP Code:
function JsonRequest($url$secret$data) {
 
$ch curl_init($url);
 
curl_setopt_array($ch, [
 
CURLOPT_POST => true,
 
CURLOPT_RETURNTRANSFER => true,
 
CURLOPT_HTTPHEADER => [
 
'Authorization: ' $secret,
 
'Content-Type: application/json',
 ],
 
CURLOPT_POSTFIELDS => json_encode($data)
 ]);

 
$response curl_exec($ch);

 return 
$response;
}


 
JsonRequest("localhost:8888""VerySecretPassword", [
 
'action' => 'RegisterUser',
 
'playername' => 'TestUser',
 
'password' => 'password'
]); 

The API also returns JSON which looks like this:
Code:
{
    "msg" : "The user is already registered",
    "result" : "failed"
}
It only returns anything if everything was okay though. I still have to make it return something if something went wrong.
Reply
Thanks given by: Boo


Messages In This Thread
Login - by NiLSPACE - 02-22-2013, 01:30 AM
RE: Login - by xoft - 02-22-2013, 01:55 AM
RE: Login - by NiLSPACE - 02-22-2013, 01:58 AM
RE: Login - by bearbin - 02-22-2013, 05:50 AM
RE: Login - by NiLSPACE - 02-22-2013, 05:57 AM
RE: Login - by bearbin - 02-23-2013, 09:40 PM
RE: Login - by NiLSPACE - 02-23-2013, 09:53 PM
RE: Login - by bearbin - 02-23-2013, 10:00 PM
RE: Login - by NiLSPACE - 02-23-2013, 10:14 PM
RE: Login - by bearbin - 02-23-2013, 10:15 PM
RE: Login - by NiLSPACE - 02-23-2013, 10:53 PM
RE: Login - by bearbin - 02-23-2013, 11:09 PM
RE: Login - by NiLSPACE - 02-23-2013, 11:10 PM
RE: Login - by bearbin - 02-23-2013, 11:19 PM
RE: Login - by NiLSPACE - 02-23-2013, 11:21 PM
RE: Login - by bearbin - 02-23-2013, 11:26 PM
RE: Login - by NiLSPACE - 02-23-2013, 11:28 PM
RE: Login - by bearbin - 02-23-2013, 11:46 PM
RE: Login - by NiLSPACE - 02-23-2013, 11:47 PM
RE: Login - by NiLSPACE - 03-07-2013, 01:57 AM
RE: Login - by NiLSPACE - 03-07-2013, 04:12 AM
RE: Login - by NiLSPACE - 03-18-2013, 02:31 AM
RE: Login - by NiLSPACE - 03-24-2013, 12:00 AM
RE: Login - by NiLSPACE - 03-25-2013, 04:18 AM
RE: Login - by NiLSPACE - 03-30-2013, 09:09 PM
RE: Login - by NiLSPACE - 06-01-2013, 05:43 AM
RE: Login - by xoft - 06-01-2013, 05:57 AM
RE: Login - by NiLSPACE - 06-01-2013, 05:58 AM
RE: Login - by xoft - 06-01-2013, 06:43 AM
RE: Login - by NiLSPACE - 06-01-2013, 07:32 AM
RE: Login - by xoft - 06-01-2013, 05:41 PM
RE: Login - by NiLSPACE - 06-01-2013, 09:06 PM
RE: Login - by NiLSPACE - 06-01-2013, 10:31 PM
RE: Login - by bearbin - 06-02-2013, 12:45 AM
RE: Login - by testeflighter - 06-11-2013, 09:20 PM
RE: Login - by NiLSPACE - 06-12-2013, 12:46 AM
RE: Login - by testeflighter - 06-12-2013, 01:02 AM
RE: Login - by xoft - 06-12-2013, 01:06 AM
RE: Login - by testeflighter - 06-12-2013, 01:34 AM
RE: Login - by NiLSPACE - 06-12-2013, 01:38 AM
RE: Login - by tonibm19 - 10-06-2013, 09:08 PM
RE: Login - by NiLSPACE - 10-06-2013, 09:18 PM
RE: Login - by tonibm19 - 10-06-2013, 09:24 PM
RE: Login - by NiLSPACE - 10-20-2013, 12:57 AM
RE: Login - by xoft - 10-20-2013, 06:19 AM
RE: Login - by NiLSPACE - 10-20-2013, 06:26 AM
RE: Login - by tigerw - 10-20-2013, 10:08 PM
RE: Login - by Pentium44 - 12-15-2014, 02:12 PM
RE: Login - by Pentium44 - 12-15-2014, 02:32 PM
RE: Login - by job_123 - 01-03-2015, 04:39 AM
RE: Login - by jan64 - 01-05-2015, 09:58 PM
RE: Login - by yanderu2 - 02-11-2015, 02:00 AM
RE: Login - by jan64 - 02-14-2015, 06:19 AM
RE: Login - by yanderu2 - 02-14-2015, 09:25 PM
RE: Login - by jan64 - 02-14-2015, 09:52 PM
RE: Login - by xoft - 02-14-2015, 09:57 PM
RE: Login - by yanderu2 - 02-15-2015, 09:10 PM
RE: Login - by NiLSPACE - 02-15-2015, 09:38 PM
RE: Login - by jan64 - 02-15-2015, 09:52 PM
RE: Login - by NiLSPACE - 02-16-2015, 09:11 PM
RE: Login - by NiLSPACE - 02-21-2015, 08:39 AM
RE: Login - by jan64 - 02-22-2015, 12:12 AM
RE: Login - by NiLSPACE - 02-22-2015, 12:19 AM
RE: Login - by NiLSPACE - 02-22-2015, 08:41 AM
RE: Login - by jan64 - 02-22-2015, 08:24 PM
RE: Login - by NiLSPACE - 02-22-2015, 08:36 PM
RE: Login - by jan64 - 02-22-2015, 08:43 PM
RE: Login - by NiLSPACE - 03-01-2015, 06:17 AM
RE: Login - by NiLSPACE - 03-03-2015, 02:30 AM
RE: Login - by jan64 - 03-03-2015, 03:10 AM
RE: Login - by xoft - 03-03-2015, 04:06 AM
RE: Login - by NiLSPACE - 04-03-2015, 09:04 PM
RE: Login - by NiLSPACE - 04-05-2015, 12:02 AM
RE: Login - by Serial - 05-23-2015, 08:44 AM
RE: Login - by NiLSPACE - 05-23-2015, 08:51 AM
RE: Login - by Serial - 05-23-2015, 11:44 AM
RE: Login - by NiLSPACE - 12-30-2015, 02:03 AM
RE: Login - by NiLSPACE - 01-28-2016, 05:24 AM
RE: Login - by KoukiShichirou - 05-25-2016, 05:39 AM
RE: Login - by NiLSPACE - 07-19-2016, 10:17 PM
RE: Login - by Boo - 09-03-2016, 09:32 PM
RE: Login - by NiLSPACE - 09-03-2016, 10:28 PM
RE: Login - by Boo - 09-05-2016, 02:20 AM
RE: Login - by NiLSPACE - 09-05-2016, 02:25 AM
RE: Login - by Boo - 09-05-2016, 02:31 AM
RE: Login - by NiLSPACE - 09-05-2016, 02:33 AM
RE: Login - by Boo - 09-05-2016, 02:50 AM
RE: Login - by NiLSPACE - 09-05-2016, 03:25 AM
RE: Login - by DrMasik - 09-05-2016, 03:57 AM
RE: Login - by NiLSPACE - 09-05-2016, 04:14 AM
RE: Login - by NiLSPACE - 09-05-2016, 05:12 AM
RE: Login - by yangm97 - 11-27-2016, 01:37 PM
RE: Login - by NiLSPACE - 11-27-2016, 04:37 PM
RE: Login - by ShadowCone - 11-27-2016, 06:56 PM
RE: Login - by NiLSPACE - 11-27-2016, 08:50 PM
RE: Login - by yangm97 - 11-28-2016, 12:58 AM
RE: Login - by NiLSPACE - 11-28-2016, 01:12 AM
RE: Login - by yangm97 - 11-28-2016, 01:52 AM
RE: Login - by NiLSPACE - 11-28-2016, 01:56 AM
RE: Login - by yangm97 - 11-28-2016, 03:37 AM
RE: Login - by deepdream - 02-16-2021, 11:41 AM
RE: Login - by NiLSPACE - 02-18-2021, 07:31 PM
RE: Login - by deepdream - 02-21-2021, 07:59 PM
RE: Login - by NiLSPACE - 02-25-2021, 08:28 PM
RE: Login - by Jmaniacs - 06-02-2021, 04:14 AM
RE: Login - by Jmaniacs - 06-02-2021, 04:20 AM
RE: Login - by NiLSPACE - 06-02-2021, 04:35 AM



Users browsing this thread: 2 Guest(s)