Skip to content

Update user current information using JSON Authentication Endpoint with the security bundle #42448

Answered by kevinG73
kevinG73 asked this question in Q&A
Discussion options

You must be logged in to vote

@dbrumann thank you , solved using :

public function refreshUser(UserInterface $user)
    {
        $identifier = $user->getUserIdentifier();
        $user = $this->userRepository->findOneBy(['email' => $identifier]);

        if (!$user instanceof User) {
            throw new UnsupportedUserException(sprintf('Invalid user class "%s".', get_class($user)));
        }

        if ($user === null) {
            throw new UserNotFoundException(sprintf('User with id %s not found', json_encode($user)));
        }

        return $user;
    }

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@kevinG73
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by kevinG73
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants