How to access an item endpoint without login token in apiato php?

Viewed 66

I have been working on invoice system which I need to add each invoice with a QR generated by a system which when we print invoice as hard copy we can just scan the QR and access the preview page of that invoice (id). I am using apiato and every time I access the endpoint I need to login to get auth token. But as for customer they don't need to login to see the preview, just to see the invoice before paying.

2 Answers

For example: remove auth:api from route middleware in path: routes/api.php

// Users
    Route::middleware('auth:api')->group( function () {
      Route::apiResource('/users', Api\UsersController::class);
      });
// or:    
    Route::group( function () {
      Route::apiResource('/users', Api\UsersController::class);
      });

// another example:
Route::apiResource('api/show-invoice', [InvoiceController::class, 'show.invoice']);
Ex: 

Route::get('invoices', [Controller::class, 'getAllInvoices'])
    ->name('')
    ->middleware(['auth:api']);

    just delete ->middleware(['auth:api']);

    Route::get('invoices', [Controller::class, 'getAllInvoices'])
    ->name('');
Related