Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support SSO #366

Merged
merged 9 commits into from
Aug 1, 2023
Merged

Support SSO #366

merged 9 commits into from
Aug 1, 2023

Conversation

Josmorsot
Copy link
Contributor

@Josmorsot Josmorsot commented Jul 25, 2023

@Josmorsot Josmorsot requested a review from a team July 25, 2023 10:31
CHANGELOG.md Outdated Show resolved Hide resolved
getAccessToken();
} else if (isAuthenticated) {
if (accountHasBeenFulfilled) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not following why you need to trust the URL to see if the user has completed the account. I think it's possible by checking the metadata only.

Copy link
Contributor

@alasarr alasarr Jul 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something like this is not working?

 if (isAuthenticated && userMetadata) {
      getAccessToken();
    }
else if (isAuthenticated && !userMetadata) {
    const searchParams = new URLSearchParams({
          redirectUri: buildAccountFulfilledUri(),
        });
        // Redirect to: accounts-www for signup on cloud-native
        window.location.href = `${redirectAccountUri}?${searchParams}`;
}
else {
   loginWithRedirect();
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, to get the metadata you need to request a new token (with loginWithRedirect). As you were loged in before having the user_metadata you need to check the url and log in again.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔

@Josmorsot Josmorsot requested a review from alasarr July 28, 2023 09:17
@@ -1,21 +1,63 @@
import { useDispatch } from 'react-redux';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not for this PR, but I would like to deprecated template-base-3 for javascript

dispatch(setCredentials({ accessToken }));
};
if (hasForceLogin) {
// if FORCE_LOGIN_PARAM is present we have to login again
Copy link
Contributor

@alasarr alasarr Jul 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// if FORCE_LOGIN_PARAM is present we have to login again
// if FORCE_LOGIN_PARAM is set a relogin is required to refresh userMetadata

Copy link
Contributor

@alasarr alasarr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very small tweaks in comments requested

@Josmorsot Josmorsot requested a review from alasarr August 1, 2023 09:21
@Josmorsot Josmorsot merged commit 2d659b8 into master Aug 1, 2023
@Josmorsot Josmorsot deleted the support-sso branch August 1, 2023 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants