Closed savisaar2 closed 9 years ago
I just tried the same thing using Mongodb if i set it up right and i am getting:
Error: Expecting a token named "token" but instead got: "<!DOCTYPE html>\r\n<html ng app=\"MyApp\">\r\n<head>\r\n <meta charset=\"utf-8\">\r\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\r\n <title>Satellizer</title>\r\n <link href=\"favicon.png\" rel=\"shortcut icon\">\r\n <link href=\"//fonts.googleapis.com/css?family=Roboto|Montserrat:400,700|Open+Sans:400,300,600\" rel=\"stylesheet\">\r\n <link href=\"//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css\" rel=\"stylesheet\">\r\n <link href=\"//code.ionicframework.com/ionicons/2.0.1/css/ionicons.min.css\" rel=\"stylesheet\">\r\n <link href=\"//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css\" rel=\"stylesheet\">\r\n <link href=\"//cdn.jsdelivr.net/animatecss/3.2.0/animate.css\" rel=\"stylesheet\">\r\n <link href=\"/stylesheets/angular-toastr.css\" rel=\"stylesheet\">\r\n <link href=\"/stylesheets/styles.css\" rel=\"stylesheet\">\r\n</head>\r\n<body>\r\n<div ng-controller=\"NavbarCtrl\" class=\"navbar navbar-default navbar-static-top\">\r\n <div class=\"navbar-header\">\r\n <a class=\"navbar-brand\" href=\"/\"><i class=\"ion-ios7-pulse-strong\"></i> Satellizer</a>\r\n </div>\r\n <ul class=\"nav navbar-nav\">\r\n <li><a href=\"/#/\">Home</a></li>\r\n <li ng-if=\"isAuthenticated()\"><a href=\"/#/profile\">Profile</a></li>\r\n </ul>\r\n <ul ng-if=\"!isAuthenticated()\" class=\"nav navbar-nav pull-right\">\r\n <li><a href=\"/#/login\">Login</a></li>\r\n <li><a href=\"/#/signup\">Sign up</a></li>\r\n </ul>\r\n <ul ng-if=\"isAuthenticated()\" class=\"nav navbar-nav pull-right\">\r\n <li><a href=\"/#/logout\">Logout</a></li>\r\n </ul>\r\n</div>\r\n\r\n<div ui-view></div>\r\n\r\n<!-- Third-party Libraries -->\r\n<script src=\"/vendor/angular.js\"></script>\r\n<script src=\"/vendor/angular-animate.js\"></script>\r\n<script src=\"/vendor/angular-messages.js\"></script>\r\n<script src=\"/vendor/angular-resource.js\"></script>\r\n<script src=\"/vendor/angular-sanitize.js\"></script>\r\n<script src=\"/vendor/angular-ui-router.js\"></script>\r\n<script src=\"/vendor/angular-toastr.tpls.js\"></script>\r\n<script src=\"/vendor/satellizer.js\"></script>\r\n\r\n<!-- Application Code -->\r\n<script src=\"/app.js\"></script>\r\n<script src=\"/directives/passwordStrength.js\"></script>\r\n<script src=\"/directives/passwordMatch.js\"></script>\r\n<script src=\"/controllers/home.js\"></script>\r\n<script src=\"/controllers/login.js\"></script>\r\n<script src=\"/controllers/signup.js\"></script>\r\n<script src=\"/controllers/logout.js\"></script>\r\n<script src=\"/controllers/profile.js\"></script>\r\n<script src=\"/controllers/navbar.js\"></script>\r\n<script src=\"/services/account.js\"></script>\r\n</body>\r\n</html>\r\n"
at Object.Shared.setToken (satellizer.js:297)
at satellizer.js:410
at processQueue (angular.js:14634)
at angular.js:14650
at Scope.$eval (angular.js:15916)
at Scope.$digest (angular.js:15727)
at Scope.$apply (angular.js:16024)
at done (angular.js:10511)
at completeRequest (angular.js:10683)
at XMLHttpRequest.requestLoaded (angular.js:10624)
Use jwt-auth by @tymondesigns to get your token from PHP. The return value should be in the form
{token : '<your token>'}
U should check on your routes coz I think you're returning a template instead
Thanks for that
I am trying to set this up with php and i have my postman returning my token however in my angular side i get a console error saying expected token return with a bunch of html.
it seems like it cant read message return as well as retrieve my correct data from db.
Is there a guide to follow for the php side?