How to set up CORS in Laravel to allow credentials and specific origins?

I’m working on a Laravel application that needs to handle CORS for requests coming from a Vue 3 frontend. I am encountering a CORS error related to credentials, and I need help configuring CORS correctly in my Laravel backend.

I receive the following error when trying to make an XMLHttpRequest from my Vue application to my Laravel backend:

Access to XMLHttpRequest at 'http://127.0.0.1:8000/api/oauth/token' from origin 'http://127.0.0.1:5173' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Credentials' header in the response is '' which must be 'true' when the request's credentials mode is 'include'.