javascript - web api authentication and ssl -
i have developed web api project has token endpoint set up. want set site calls api have created javascript function:
$.ajax({ url: "http://path.to.site/token", data: { grant_type: "password", username: "user", password: "password" } }).done(function (data) { console.log(data); }).fail(function (errror) { console.log(error); });
even ssl enabled on both sites, if user view source of site able see username , password. if got access token using server side code (php, .net or whatever) still have pass access token javascript api calls , again readable.
i feel missing here, can explain me is? :d
what use server generate jwt when generates site.
in jwt embed claims site, , pass jwt bearer token client api. api use shared secret (that site , api know about) generate jwt signature make sure if tamper proof while on client. using common jwt features such exp, iat, , jti, can secure information further.
i hope help. work company, stormpath, helps these types of problems (api authentication, user management).
Comments
Post a Comment