this.userId or this.user() is always null in protected function
See original GitHub issueHello, I would like to protect the files from being accessible by a non-connected user. At the moment anyone can do : http://my-app.com/cdn/storage/Files/fileId/original/fileId.pdf and the file is presented to the browser (even if the user is not connected)
I have implemented :
configServer["protected"] = function(fileObj){
console.log("protected > this.userId : ", this.userId); //This returns always null
if (this.userId){return true;}
return false
}
But this.userId or this.user() always return null.
I am using v 1.11.2. with Meteor 1.8.1
I am both :
- accessing with direct link : http://my-app.com/cdn/storage/Files/fileId/original/fileId.pdf
- accessing inside the Meteor webUI using fileObj.link()
Is this a normal behavior ? I have seen some discussion about taking the userId from cookies. Do I have to activate/set cookies somewhere before in my app or MeteorFiles is doing it ? Thanks
Similar issues :
Issue Analytics
- State:
- Created 4 years ago
- Comments:24 (12 by maintainers)
Top Results From Across the Web
Auth::user() returns null - php - Stack Overflow
I faced a situation where Auth::user() always returns null , it was because I was trying to get the User in a controller's...
Read more >Auth::user always returning null · Issue #30402 - GitHub
Here is my controller code. After trying different methods found around the web nothing seems to work! | is assigned the "api" middleware...
Read more >Auth::user() returns null value - Laracasts
I'm working on username authentication. I thought my LoginController is working perfectly.But when i go to the page and do login.The page will...
Read more >Authentication - Laravel - The PHP Framework For Web Artisans
When the auth middleware detects an unauthorized user, it will either return a JSON 401 response, or, if the request was not an...
Read more >Magic Methods - Manual - PHP
If the method doesn't return anything then null is serialized and E_NOTICE is issued. Note: It is not possible for __sleep() to return...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Hello, We did together place
account-baseaboveostrio:filesin the meteor/package files. But I had other sub packages that were usingostrio:fileslike this :api.use(['ostrio:files])and these packages did not haveaccount-basedeclared above. I have replaced byapi.use(['account-base', 'ostrio:files'])and it seems to work. I will try and make tests beginning of january and let you know. Thanks and have a nice Christmas.Yes. account-base should be before ostrio:files also in subpackages. Thanks for your help.