2014-01-11, 10:30 PM
Ok, basically, I need a little API, something to allow an application of mine to be able to authenticate logins. I made plugins like aggeeessss ago for MyBB, but not recently ^_^
I was thinking, send a JSON request, containing the username and password, then get a JSON response back containing the usergroup and a hash.
The hash would just be md5(username.password_hash), so the hash could be used instead of username/password (so it can be saved for future logins).
So the request would be like this:
And the response would be:
Basically, when I send json to mysite.com/api.php, i say "hey I want to validate this user, here's their username and password"
Then the server says "yup thats correct, here's a hash to use later instead"
So, the question is, how to I use the database in MyBB
I was thinking, send a JSON request, containing the username and password, then get a JSON response back containing the usergroup and a hash.
The hash would just be md5(username.password_hash), so the hash could be used instead of username/password (so it can be saved for future logins).
So the request would be like this:
[
"action": "login",
"type": "userpass",
"username": "tom",
"password": "password",
"hash": ""
]
And the response would be:
[
"username": "tom",
"sessionHash": "fsfdifsjoidjiojioewre89uerw...",
"usergroup": "4"
]
Basically, when I send json to mysite.com/api.php, i say "hey I want to validate this user, here's their username and password"
Then the server says "yup thats correct, here's a hash to use later instead"
So, the question is, how to I use the database in MyBB