I think that you don't get the point of my question.
I am talking about client_secret and not client_id and token.
I am not sure if you understand, so I am linking you the official explanation of what a client_secret is: https://tools.ietf.org/html/rfc6749#section-2.3.1
I would personally use environment variables to store the id and token, which would be referenced during your deployment/build process and not stored in your development files.
I am referring to client_secret that a mobile app should know before token request. A mobile app don't have access to environment variables.
I suggest to read this article if you want to know more about:
https://esbenp.github.io/2017/03/19/modern-rest-api-laravel-part-4/
In this article it explain how it should be.
But he don't explain how to do with passport, but he suggest to use a library that author of article has make.
In normal case where you can store in your application the client_secret without worrying that can be hacked would be below scenario:
The client logs in directly from authentication server
======================================================
User credentials
Client credentials
Client -----------------> Auth server
<-----------------
Access token
Refresh token
The client requests resources from the API
======================================================
Access token
Client -----------------> API
<-----------------
Some resource
But with mobile apps or javascript app the source code can be visible to hackers. So you can't store client_secret in application.
So that article suggest below scenario:
The client logs in using the API which uses the auth server
===========================================================
Client credentials
User credentials User credentials
Client ----------------> API ------------------> Auth server
<---------------- <------------------
Access token Access token
Refresh token Refresh token
The client requests resources from the API
======================================================
Access token
Client -----------------> API
<-----------------
Some resource
I understand how it should work, but my question is how this can be done with Passport. I don't have experience with Laravel nor with Passport, so I am asking if someone has already had this similar issue, and maybe there is already a good solution that would save me time.