I am looking for the best way to secure my applications login api from third parties attempting to hijack it. I am using Apigility, ZF2, Jquery.
I have a game server (Server G) and a cloud server (Server C).
While Server C - holds usernames and passwords, users sign up and login via server G.
Both server C and G have their own API's using ApiGility.
When a user logs into server G, the jquery app calls its own API which in turn uses Oauth2 to contact server C to verify the entered credentials. This way, every game in my network has a single Bearer token connection to my cloud and each game handles its own connections to its clients (mobile / browser / desktop etc.). Keeps things clean.
While server G to C is secure, how do I secure the javascript call to its own API ?
The javascript exposes the local apps api call which essentially means anyone can grab the url and play with it :)
var url ='http://server-g.example.com/api/login/' + email + '/' + password;
$.ajax({
type: 'GET',
async: true,
url: url,
dataType: "json",
success: function(responseObject){
if (responseObject.status)
{
//Do stuff
} else {
//Do other stuff
}
}
});
I have been thinking of using an implicit grant, however, I am not sure how this would work with my own api?
What would the standard solution be?