You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to implement the password grant flow between an angular SPA and symfony api back end. My understanding is that I should use the password grant flow. The SPA will serve 3 different brand sites and we will have 3 different OAuth Clients.
The first thing I don't get is since the SPA can't contain the client secret which oauth end point I'll be hitting to get the access token.
Right now we have a two steps registration process and in second step I need to return an access token for the user in order to complete profile. I'm restricting this end point with 'registration' scope and the user will have the role ROLE_USER_INACTIVE + obviously ROLE_OAUTH2_REGISTRATION. So the user can't access anything else. I'm providing the access token like this:
Here the password sin't taken into account, here is my UserResolveListener
public function onUserResolve(UserResolveEvent $event): void
{
$user = $this->userBrandProvider->loadPlayerByUsernameClient($event->getUsername(), $event->getClient()->getIdentifier());
if (null === $user) {
return;
}
if ($user->isActive()) {
if (!$this->userPasswordEncoder->isPasswordValid($user, $event->getPassword())) {
return;
}
} else {
if (!$user->isRegistrationOngoing()) {
return;
}
}
$event->setUser($user);
}
Basically in case the user is inactive, I'm checking if the registration is ongoing and without checking the password (since I don't have it) I'm setting the user to the event.
But I'm not using the 2 oauth end points defined in routes/trikoder_oauth2.yaml
oauth2_authorize:
path: /oauth/v2/authorize
defaults: { _controller: Trikoder\Bundle\OAuth2Bundle\Controller\AuthorizationController::indexAction, _method: GET }
oauth2_token:
path: /oauth/v2/token
defaults: { _controller: Trikoder\Bundle\OAuth2Bundle\Controller\TokenController::indexAction, _method: POST }
My question is am I missing something and how I would implement the login? Also since the SPA can't contain the client secret how it would use the refresh token as well?
Thanks
The text was updated successfully, but these errors were encountered:
Hi,
I need to implement the password grant flow between an angular SPA and symfony api back end. My understanding is that I should use the password grant flow. The SPA will serve 3 different brand sites and we will have 3 different OAuth Clients.
The first thing I don't get is since the SPA can't contain the client secret which oauth end point I'll be hitting to get the access token.
Right now we have a two steps registration process and in second step I need to return an access token for the user in order to complete profile. I'm restricting this end point with 'registration' scope and the user will have the role ROLE_USER_INACTIVE + obviously ROLE_OAUTH2_REGISTRATION. So the user can't access anything else. I'm providing the access token like this:
Here the password sin't taken into account, here is my UserResolveListener
Basically in case the user is inactive, I'm checking if the registration is ongoing and without checking the password (since I don't have it) I'm setting the user to the event.
But I'm not using the 2 oauth end points defined in routes/trikoder_oauth2.yaml
My question is am I missing something and how I would implement the login? Also since the SPA can't contain the client secret how it would use the refresh token as well?
Thanks
The text was updated successfully, but these errors were encountered: