John Davidson

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

0 comments
Message:


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.



My Answer:
One way to access an item endpoint without a login token in Apiato is to create a separate endpoint specifically for previewing the invoice. This endpoint can be public and accessible without authentication.

Here's an example of how you can create a public endpoint for previewing an invoice in Apiato:

1. Create a new endpoint in your Apiato project for previewing the invoice. You can do this by creating a new action in a controller.

2. In the action for previewing the invoice, you can retrieve the invoice details using the invoice ID provided in the request.

3. Generate the QR code for the invoice and return it along with the invoice details in the response.

4. Make sure to set the authentication middleware for this endpoint to 'public' or 'guest' so that it can be accessed without a login token.

5. Update the QR code on the invoice template to point to this new public endpoint for previewing the invoice.

By following these steps, you can create a public endpoint for previewing the invoice without the need for a login token in Apiato. This will allow customers to easily access the preview page of the invoice by scanning the QR code without having to log in.

Rate this post

3 of 5 based on 9826 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us