0

I'm trying to attach the browser agent and IP address to each access token the user generates on login (it will allow the user to view where they logged in and what device they used similar to Google).

I can't seem to find where the access_token and id were generated so I could put the code to add the extra data.

I was able to trace from HasApiTokens.php to PersonalAccessTokenFactory.php that would fire the make function.

I want to know where inside Passport generates the token.

Eric Wang
  • 419
  • 2
  • 6
  • 23
  • Does this answer your question? [Customising token response Laravel Passport](https://stackoverflow.com/questions/43146964/customising-token-response-laravel-passport) – Brian Lee Apr 15 '20 at 23:36
  • No, I'm attempting to add user agent info to the row containing the oauth_access_token but thanks. – Eric Wang Apr 15 '20 at 23:54
  • The access token is a JWT. You add these custom claims - i.e. browser agent, ip, etc. - to the JWT as explained in the above answer. – Brian Lee Apr 16 '20 at 00:00
  • 1
    I'm attempting to only add the user agent info to the row containing the access token inside the oauth_access_token table. I just want to find a way to store the data for reference. I only have laravel/passport installed. – Eric Wang Apr 16 '20 at 00:24

0 Answers0