Skip to content

How to customize the AuthToken? #34

@selfsimilar

Description

@selfsimilar

Using openidconnect.net I've compared the auth tokens issued by laravel-openid-connect-server and Google'a OAuth flow and Google returns userdata in the AuthToken. Compare:

This Library

Header

{
  "typ": "JWT",
  "alg": "RS256",
  "kid": "1",
  "sub": 1
}

Payload

{
  "iss": "https://example.net",
  "sub": "1",
  "aud": "12345678-0abc-def1-2345-67890",
  "exp": 1709582589.667932,
  "iat": 1709581989.667932,
  "jti": "8a6b279c7c170581a27a55c797e207075db9c1fb1b036cd40981323fdc09c259f575f5c3b0a7776c",
  "auth_time": 1709581983,
  "nonce": null
}

Google

Header

{
  "alg": "RS256",
  "kid": "12345678901234567890",
  "typ": "JWT"
}

Payload

{
  "iss": "https://accounts.google.com",
  "azp": "12345678-0abc-def1-2345-67890",
  "aud": "12345678-0abc-def1-2345-67890",
  "sub": "12345678901234567890",
  "email": "example@example.com",
  "email_verified": true,
  "at_hash": "whatever",
  "name": "John Doe",
  "picture": "https://lh3.googleusercontent.com/a/;lkjasdf;lkjasdf;lkajsdf",
  "given_name": "John",
  "family_name": "Doe",
  "iat": 1709581989.667932,
  "exp": 1709582589.667932
}

As this format is accepted by Firebase (who I am trying to integrate with) I'd like to use this as a template and at least add the personal details to the token.

This library's routes file sends POST requests to oauth/token to Laravel Passport's AccessTokenController::issueToken() function which eventually uses the openid-connect-server AuthCodeGrant::respondToAccessTokenRequest() function. I notice in that function there is a TODO on line 206 "populate idToken with claims ...". The associated next line calls out to a stub function addMoreClaimsToIdToken(). Did you have a plan for this? Or should I extend the AuthCodeGrant class to implement this in a custom class in Laravel to add these claims?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions