Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var authenticateUrl = "/authenticate"
- var authenticate = function (successCallback) {
- sendRequest(authenticateUrl, "POST", {
- "grant_type": "password", username: model.username(), password: model.password()
- }, function (data) {
- model.authenticated(true);
- setAjaxHeaders({
- Authorization: "bearer " + data.access_token
- });
- if (successCallback) {
- successCallback();
- }
- });
- };
- var testAuth = function () {
- model.username('Admin');
- model.password('secret');
- authenticate();
- }
Add Comment
Please, Sign In to add comment