question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

User is always null?

See original GitHub issue

image

If I remove = null I get a 403. Am I doing something wrong here or is this part broken?

>>> env('WEB_TINKER_ENABLED', false)
=> true

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
rubenvanasschecommented, Oct 16, 2019

Hi @edgrosvenor,

thanks for your extensive research into this problem! Indeed adding the web middleware group will fix this problem but actually only the StartSession and EncryptsCookies middlewares from the web group are required to solve this problem.

So I’ve added them(c693f3f951ae9f8d33dc7cd27ea511ad59b0880b) and tagged a new release!

Thanks guys!

1reaction
edgrosvenorcommented, Oct 4, 2019

In the mean time, this will get anyone who’s stuck past the problem. Do this in your web.php route file:

use Spatie\WebTinker\Http\Controllers\WebTinkerController;
use Spatie\WebTinker\Http\Middleware\Authorize;


Route::prefix('web_tinker')->middleware(['web', Authorize::class])->group(function () {
    Route::get('/', [WebTinkerController::class, 'index']);
    Route::post('/', [WebTinkerController::class, 'execute']);
});

Obviously use anything you like in the prefix as long as it does not match the path set in the web tinker config file.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Current User in ASP.NET Core is always null - MSDN - Microsoft
I am trying to get the current user name who is logged in using windows authentication in .net controller and I am always...
Read more >
Middleware access to User is always null but controller can ...
This is working, I can see the user, I am redirected to login, all good. BUT, if I try to access the user...
Read more >
$request->user() returns null even though the user ... - Laracasts
returns false and I reach my controller method just fine. Also dd($user) in AuthenticationProvider.php (just before the return ) dumps the right user...
Read more >
Why is my currentUser == null in Firebase Auth? - Medium
Auth state seems binary: null or non-null (or is it?)​​ The current user object ends up being null, even if the user previously...
Read more >
[firebase_auth] getter currentUser always returns null #5964
When I call FirebaseAuth.instance.currentUser it's always null. Subscribing to the stream FirebaseAuth.instance.authStateChanges() will emit a ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found