Skip to content

Full phase1 + phase2 CLI update #143

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

Open
wants to merge 90 commits into
base: master
Choose a base branch
from

Conversation

DBozhinovski
Copy link
Contributor

Summary of change

Phase 1 and phase 2 changes, sans mutlitenancy for next, CLI flags and e2e test.

connor and others added 30 commits December 15, 2024 03:37
@DBozhinovski DBozhinovski requested a review from porcellus March 4, 2025 14:40
@@ -6,7 +6,7 @@ export let backendConfig = (): TypeInput => {
return {
supertokens: {
// this is the location of the SuperTokens core.
connectionURI: STConfig.supertokens.connectionURI,
connectionURI: (STConfig.supertokens as { connectionURI: string }).connectionURI,
Copy link
Collaborator

Choose a reason for hiding this comment

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

is this necessary?

Comment on lines +128 to +130
ContactMethodEmailOrPhone: plessmodels.ContactMethodEmailOrPhoneConfig{
Enabled: true,
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

this should be built like the flowtype above

let template = "";
const recipes = configToRecipes[configType].filter((recipe) => recipe !== "multiFactorAuth" && recipe !== "totp");

const needsEmailVerification = false;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think this is correct. (or it's unnecessary)

userArguments?: UserFlags;
}): string => {
let template = "";
const recipes = configToRecipes[configType].filter((recipe) => recipe !== "multiFactorAuth" && recipe !== "totp");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's throw instead, if they requested MFA with go then it'll not work, it's better to fail than to generate a partial result.

clientSecret: "${provider.clientSecret}",
${
provider.additionalConfig
? `additionalConfig: ${JSON.stringify(provider.additionalConfig, null, 36)}`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we run the generated thing through a formatter? (e.g., prettier) We can add it to the backlog it's not necessary now.

@@ -0,0 +1,35 @@
import { type IndividualRecipe, type ConfigType } from "./types";

export const configToRecipes: Record<ConfigType, IndividualRecipe[]> = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

where is this used?

Comment on lines +304 to +311
if (hasMFA && isGoBackend) {
console.warn(
"\x1b[33m%s\x1b[0m",
"⚠️ Warning: Multi-factor authentication is not fully supported in the Go SDK yet. " +
"The generated app may not have full MFA functionality. " +
"Consider using a Node.js/Express backend for complete MFA support."
);
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd prefer if this failed instead.

emailPassword:
'import EmailPassword from "supertokens-auth-react/recipe/emailpassword";\nimport { EmailPasswordPreBuiltUI } from "supertokens-auth-react/recipe/emailpassword/prebuiltui";',
thirdParty:
'import ThirdParty, { Google, Github, Apple, Twitter } from "supertokens-auth-react/recipe/thirdparty";\nimport { ThirdPartyPreBuiltUI } from "supertokens-auth-react/recipe/thirdparty/prebuiltui";',
Copy link
Collaborator

Choose a reason for hiding this comment

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

We could use ThirdParty.Google instead of importing Google directly. That way, we can drop unnecessary imports.

Comment on lines +87 to +98
getGlobalClaimValidators: (input) => {
const emailVerificationClaimValidator = input.claimValidatorsAddedByOtherRecipes.find(
v => v.id === EmailVerification.EmailVerificationClaim.id
);
if (emailVerificationClaimValidator) {
const filteredValidators = input.claimValidatorsAddedByOtherRecipes.filter(
v => v.id !== EmailVerification.EmailVerificationClaim.id
);
return [...filteredValidators, emailVerificationClaimValidator];
}
return input.claimValidatorsAddedByOtherRecipes;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we can/should drop this. If Mfa doesn't work without it, LMK and we'll fix it.

Comment on lines +146 to +148
getRequiredSecondaryFactorsForUser: async () => {
return [${factorIds.join(", ")}];
},
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can drop this. It's not used by default.

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.

4 participants