mjtpage

Member Since 1 Year Ago

Experience Points
7,070
Total
Experience

2,930 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
69
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

  • Community Pillar

    Earned once your experience points ranks in the top 10 of all Laracasts users.

Level 2
7,070 XP
Jun
10
2 days ago
Activity icon

Replied to Problem With Sanctum Middleware

Hi @martinbean

I stripped everything out of the routes so that my web route just has one entry

Route::middleware('auth:sanctum')->post('ponocms/app', '[email protected]');

I tried hitting that route like this with an invalid bearer token

$ch = curl_init(); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'Content-Type: application/json', 'Authorization: Bearer IujhOVrfBnwz1fdaywtGJN5TXXkcxLb3Ou8Yd9HO', )); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_URL, 'https://ponocms.com/ponocms/app'); $txtRes = curl_exec($ch); curl_close($ch); dd($txtRes);

But it's still letting me right through to the MobileappController. The bearer token is not valid, the user is also signed out of the website. I added some logging to the App\Http\Middleware\Authenticate middleware and I see that each request that comes in to the 'ponocms/app' route is hitting that. I'm not sure if that is intended or not?

I'm totally stuck, I read the Laravel docs from top to bottom, I tried using the api routes, I tried changing the config/sanctum file but I just can't get the Sanctum middleware to kick in. Thanks for any help you can give!

Jun
08
4 days ago
Activity icon

Replied to Problem With Sanctum Middleware

Thanks for your quick reply @martinbean

If I add the auth:sanctum middleware should it still be hitting the Authenticate middleware? My understanding is that it shouldn't, but maybe I'm misunderstand and the incoming request still goes through the Authenticate middleware?

But even after it passes this it should continue to Laravel\Sanctum\Guard. And it's not hitting that at all, I added info('log this') commands to the __construct and __invoke functions and it doesn't appear to be calling them. So unless I'm misunderstanding it looks as though it's not going through the Sanctum authorization?

Thanks again for your help :)

Activity icon

Started a new Conversation Problem With Sanctum Middleware

Hi everyone,

I've set up Sanctum to use with a mobile app. The first step (getting a token) is working fine, but the second step (passing the token as a bearer token and protecting routes via auth:sanctum middleware) is not.

Here's what the route looks like:

Route::middleware('auth:sanctum')->post('pono/app', '[email protected]');

When I hit the pono/app route it's loading the regular Authenticate middleware but it's letting everyone through, it's not checking for the bearer token. So if I change the route from post to get I'm able to just open it in the browser, Sanctum is not protecting it.

Really I need Sanctum to ignore the regular Authenticate middleware (as we have something in there to block anyone who is not signed in, and that will of course block anyone coming via the app) and just use the sanctum middleware. I could write a custom middleware that checks for the presence of the bearer token but I'm sure that's not what Laravel intends :)

Any idea what I'm missing?