Comments (3)
why is this closed? I just cloned the repository and simulated the problem by deleting session cookies in the browser right before I create an article.
This results in the above middleware catching and making the call to "return res.redirect('/login')). However, the browser does not do a proper redirect to /login as expected.
Browser redirected to http://localhost:3000/#!/articles/undefined
the is the stack trace:
CastError: Cast to ObjectId failed for value "undefined" at path "_id" at ObjectId.cast (C:\Users\shawnlim\Documents\Websites\angularjs\mean\node_m odules\mongoose\lib\schema\objectid.js:116:13) at ObjectId.castForQuery (C:\Users\shawnlim\Documents\Websites\angularjs\mea n\node_modules\mongoose\lib\schema\objectid.js:165:17) at Query.cast (C:\Users\shawnlim\Documents\Websites\angularjs\mean\node_modu les\mongoose\lib\query.js:412:32) at Query.findOne (C:\Users\shawnlim\Documents\Websites\angularjs\mean\node_m odules\mongoose\lib\query.js:1762:10) at Query.exec (C:\Users\shawnlim\Documents\Websites\angularjs\mean\node_modu les\mongoose\lib\query.js:171:16) at Function.ArticleSchema.statics.load (C:\Users\shawnlim\Documents\Websites \angularjs\mean\app\models\article.js:41:29) at exports.article (C:\Users\shawnlim\Documents\Websites\angularjs\mean\app\ controllers\articles.js:14:13) at paramCallback (C:\Users\shawnlim\Documents\Websites\angularjs\mean\node_m odules\express\lib\router\index.js:151:7) at param (C:\Users\shawnlim\Documents\Websites\angularjs\mean\node_modules\e xpress\lib\router\index.js:133:11) at pass (C:\Users\shawnlim\Documents\Websites\angularjs\mean\node_modules\ex press\lib\router\index.js:145:5)
how can the problem be solved?
from mean.
hey @geekyme, it was close because it was duplicate, i now added the duplicate label, i just pushed a fix to the authentication middleware that solves the entire issue.
The seed project didn't include angular so the authentication middleware behaved differently of what it should have.
from mean.
i just tried it, receiving a PUT http://localhost:3000/articles/522d7e1fc31738382f000004 401 (Unauthorized) in browser console log now when I deleted the session cookie.
Do I have to do a redirect to login page on the client side?
from mean.
Related Issues (20)
- ERROR:Service 'app' failed to build: failed to register layer: Error processing tar file(exit status 1): write /usr/lib/gcc/x86_64-linux-gnu/6/lto1: no space left on device
- Try this command
- postman-1 HOT 1
- [nodemon] app crashed - waiting for file changes before starting...s before starting... HOT 2
- Nodemon crash HOT 1
- can't run the server side throw new Error(`Config validation error: ${error.message}`); [SERVER] ^ HOT 2
- \
- error HOT 1
- I have a problem with this issue . How I can solve this .
- [nodemon] app crashed - waiting for file changes before starting... HOT 1
- Problem in running server HOT 1
- Callback is not a function! issue HOT 1
- [nodemon] app crashed - waiting for file changes before starting...
- solucion de error...
- [nodemon] app crashed - waiting for file changes before starting
- ??
- The GitHub About description still says Angular 6 HOT 1
- app/auth/register typo
- Best practices for Next steps, please
- Troubles doing 'const customerSaved = await newCustomer.save()'
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mean.