-
Notifications
You must be signed in to change notification settings - Fork 7
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
base: master
Are you sure you want to change the base?
Conversation
@@ -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, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this necessary?
ContactMethodEmailOrPhone: plessmodels.ContactMethodEmailOrPhoneConfig{ | ||
Enabled: true, | ||
}, |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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)
boilerplate/backend/shared/go/go.ts
Outdated
userArguments?: UserFlags; | ||
}): string => { | ||
let template = ""; | ||
const recipes = configToRecipes[configType].filter((recipe) => recipe !== "multiFactorAuth" && recipe !== "totp"); |
There was a problem hiding this comment.
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)}` |
There was a problem hiding this comment.
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[]> = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where is this used?
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." | ||
); | ||
} |
There was a problem hiding this comment.
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";', |
There was a problem hiding this comment.
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.
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; | ||
} |
There was a problem hiding this comment.
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.
getRequiredSecondaryFactorsForUser: async () => { | ||
return [${factorIds.join(", ")}]; | ||
}, |
There was a problem hiding this comment.
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.
Summary of change
Phase 1 and phase 2 changes, sans mutlitenancy for next, CLI flags and e2e test.