diff --git a/app/Providers/AuthServiceProvider.php b/app/Providers/AuthServiceProvider.php index 7936e8d..c02d1b6 100644 --- a/app/Providers/AuthServiceProvider.php +++ b/app/Providers/AuthServiceProvider.php @@ -30,7 +30,8 @@ class AuthServiceProvider extends ServiceProvider $this->app['request']->mixin(new RequestMixin); $this->app['request']->mixin(new BusinessInfoRequestMixin); - $this->app['auth']->viaRequest('api', function ($request) { + $this->app['auth']->viaRequest('token', function ($request) { + if ($request->bearerToken() === null) { return null; } diff --git a/routes/api.php b/routes/api.php index aa1192e..7e8d9c9 100644 --- a/routes/api.php +++ b/routes/api.php @@ -31,7 +31,7 @@ $router->group(['prefix' => 'auth'], function () use ($router) { $router->get('google/callback', 'AuthController@handleGoogleCallback'); }); -$router->group(['prefix' => 'businesses'], function () use ($router) { +$router->group(['prefix' => 'businesses', 'middleware' => 'auth:api'], function () use ($router) { $router->get('/', 'BusinessController@index'); $router->post('/', 'BusinessController@store');