Browse Source

some minor change in auth and related configs

remotes/origin/mohammad
mahdihty 4 years ago
parent
commit
fce7fcc652
  1. 5
      app/Http/Controllers/AuthController.php
  2. 2
      config/services.php
  3. 8
      routes/api.php

5
app/Http/Controllers/AuthController.php

@ -189,7 +189,8 @@ class AuthController extends Controller
*/
public function logout(Request $request)
{
$token = $request->getCurrentToken();
$token = $request->bearerToken();
if (blank($token)) {
return new JsonResponse([
'message' => 'Not authorized request.',
@ -216,7 +217,7 @@ class AuthController extends Controller
public function revoke(string $token)
{
/** @var Fingerprint $token */
$token = Auth::user()->fingerprints()->firstWhere([
$token = Fingerprint::firstWhere([
'token' => $token,
]);

2
config/services.php

@ -16,6 +16,6 @@ return [
'google' => [
'client_id' => '1002439248397-oa6hnh25n6qri3q4kst62gvb1k9ki65l.apps.googleusercontent.com',
'client_secret' => 'tKbiyh5hOjYIcj-W1y3N8X5R',
'redirect' => 'http://localhost:8000/user/v1/auth/google/callback',
'redirect' => env('APP_URL').'/user/v1/auth/google/callback',
],
];

8
routes/api.php

@ -14,11 +14,11 @@ $router->get('/callback', 'CreditController@callback');
$router->get('/{transaction}/redirection', 'CreditController@redirection');
$router->group(['prefix' => 'auth'], function () use ($router) {
$router->get('/', 'AuthController@auth');
$router->get('/', 'AuthController@auth')->middleware('auth:api');
$router->delete('/', 'AuthController@delete');
$router->get('/info', 'AuthController@authWithInfo');
$router->post('login', 'AuthController@login');
$router->post('logout', 'AuthController@logout');
$router->post('logout', 'AuthController@logout')->middleware('auth:api');
$router->post('register', 'AuthController@register');
$router->post('revoke/{token}', 'AuthController@revoke');
@ -27,8 +27,8 @@ $router->group(['prefix' => 'auth'], function () use ($router) {
$router->post('verification', 'AuthController@verification');
$router->get('google/redirect', 'AuthController@redirectToGoogle');
$router->get('google/callback', 'AuthController@handleGoogleCallback');
$router->get('google/redirect', 'AuthController@redirectToGoogle')->name('google.redirect');
$router->get('google/callback', 'AuthController@handleGoogleCallback')->name('google.callback');
});
$router->group(['prefix' => 'businesses', 'middleware' => 'auth:api'], function () use ($router) {

Loading…
Cancel
Save