Closed neomerx closed 7 years ago
Passport
settings has key KEY_TOKEN_CUSTOM_PROPERTIES_PROVIDER
which could be set as an calalble method returning extra token properties. The signature of the method is the following
public static method tokenExtraMethodProvider(ContainerInterface $container, TokenInterface $token): array {
retun ...;
}
Passport
settings could have a methods for adding extra properties
/**
* @inheritdoc
*/
protected function getTokenCustomPropertiesProvider()
{
return [self::class, 'tokenCustomPropertiesProvider'];
}
public static function tokenCustomPropertiesProvider(ContainerInterface $container, TokenInterface $token): array
{
return [
'user_id' => $token->getUserIdentifier(),
];
}
The spec defines ability to add custom properties to OAuth token https://tools.ietf.org/html/rfc6749#section-4.1.4 https://tools.ietf.org/html/rfc6749#section-4.3.3 https://tools.ietf.org/html/rfc6749#section-4.4.3