HWIOAuthBundle add token attribute after success auth

I use HWIOAuthBundle for Symfony.

HWIBundleOAuthBundleSecurityCoreAuthenticationProviderOAuthProvider.php has function "authenticate" where create and return OAuthToken.

public function authenticate(TokenInterface $token){
    $token = new OAuthToken($oldToken->getRawToken(), $user->getRoles());

    return $token;

I need set some attribute to this OAuthToken like :

$token->setAttribute('name' => 'value');

How can i do this ?

I use service with only one function "loadUserByOAuthUserResponse" which return user object :

class PartnerEntityUserProvider implements OAuthAwareUserProviderInterface{
   public function loadUserByOAuthUserResponse(UserResponseInterface $response){
      return $user;

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *