TimeSocks

Member Since 5 Years Ago

Experience Points
14,590
Total
Experience

410 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
25
Lessons
Completed
Best Reply Awards
2
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 3
14,590 XP
Jan
20
6 days ago
Activity icon

Replied to Three Cookies Rejected For Invalid Domain On Local Dev Machine

Oh, believe me, I have tried it with the port number. I've tried it with and without http. I've tried 127.0.0.1. I've tried every combination I can think of.

Jan
19
1 week ago
Activity icon

Started a new Conversation Three Cookies Rejected For Invalid Domain On Local Dev Machine

I'm having a problem with cookies, presumably some kind of CORS problem, but I don't know why. When I load my app on my local machine just running a standard php artisan serve server, the console shows:

Cookie “XSRF-TOKEN” has been rejected for invalid domain.
Cookie “appname_session” has been rejected for invalid domain.
Cookie “1Z1IE4mp5AZjYQ9KlnblgapiAgpRfI3kjQ8RY0JB” has been rejected for invalid domain.

In my .env, I have the following:

APP_URL=http://localhost
SESSION_DOMAIN=http://localhost

I've tried various versions of that, with and without port number, quotes etc. Any ideas?

Aug
25
5 months ago
Activity icon

Started a new Conversation Laravel Sanctum And Vue - Unauthenticated Error

I have now followed two separate methods for using Laravel Sanctum for authentication in my Laravel 7/Vue SPA. Both have run into the same problem. Here are the methods:

https://blog.codecourse.com/setting-up-laravel-sanctum-airlock-for-spa-authentication-with-vue/

https://dev.to/aschmelyun/authenticating-a-vue-spa-is-easy-with-laravel-sanctum-392a

Both do much the same thing - install Sanctum, install the standard auth scaffolding, set up the middleware, add a dummy user or two. Then, use Axios to hit the sanctum/csrf-cookie route, then the /login routes, passing in an email and password.

However, with both methods, I get the same issue - a 401 'Unauthenticated' error. The Network tab of the browser dev tools shows that the sanctum/csrf-cookie route returns 204 and the Laravel session and XSRF cookies are set. The login route shows 302 and a redirect to /home which is the standard Laravel auth redirect. Then when it hits the route defined in the api.php file:

Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
    return $request->user();
});

It returns 401 - Unauthenticated.

Now, the only thing that makes this work seemingly as intended is tweaking the mapApiRoutes() function in RouteServiceProvider.php:

protected function mapApiRoutes()
    {
        Route::prefix('api')
            ->middleware('api')
            ->namespace($this->namespace)
            ->group(base_path('routes/api.php'));
    }

Changing the middleware property from 'api' to 'web' fixes the issue. But that seems to be a complete bodge and something that I shouldn't need to do.

Any ideas?

Aug
24
5 months ago
Activity icon

Awarded Best Reply on 422 Error When Logging In

Found the answer in case it helps anyone in future: the problem seemed to be with the password hashing. Once I created a few users with a factory using

'password' => Hash::make('password')

Then it worked.

Activity icon

Replied to 422 Error When Logging In

Found the answer in case it helps anyone in future: the problem seemed to be with the password hashing. Once I created a few users with a factory using

'password' => Hash::make('password')

Then it worked.

Activity icon

Started a new Conversation 422 Error When Logging In

I'm running into an error when trying to login using Sanctum and the standard auth scaffolding. I have one user in the users table and I'm using the exact details, but i'm getting a 422 error: these credentials do not match our records for the e-mail address.

The Sanctum cookies are being set fine. I'm using the correct details. The User model is Authenticatable, and the users model path is set correctly in config/auth.php. The User is using the hashed password from the default UserFactory.

I am using Vue to hit the default /login route, passing an object containing email and password. Vue Devtools show the input is being bound to the variables.

data() {
        return {
            formData:{
                email:null,
                password:null
            }
        }
    },
    methods:{
        login(){
            axios.get('/sanctum/csrf-cookie').then(response => {
                try {
                    axios.post('/login', this.formData).then(response =>{
                        console.log(response)
                    })
                } catch (error) {
                    console.log(error)
                }
            });
        }
    }

Any ideas?

Aug
10
5 months ago
Activity icon

Replied to Laravel Lighthouse Config - Unable To Locate Publishable Resources

@sinnbeck ah, I wondered about that but didn't know if Laravel did some magic registering of configs or something that needed the publish command to work. Thanks!

Activity icon

Started a new Conversation Laravel Lighthouse Config - Unable To Locate Publishable Resources

I have installed the latest version of Lighthouse into my Laravel 7 app and it's been working fine with the out-of-the-box config. I now want to tweak some settings for better security, so as per the docs I have tried to use the following command:

php artisan vendor:publish --tag=lighthouse-config

to publish the config file. But I get the following error:

Unable to locate publishable resources.
Publishing complete.

No lighthouse.php file is published to the config folder. Any ideas how to fix this?