MCPcopy Create free account
hub / github.com/supabase/auth / validateSignupParams

Method validateSignupParams

internal/api/signup.go:32–57  ·  view source on GitHub ↗
(ctx context.Context, p *SignupParams)

Source from the content-addressed store, hash-verified

30}
31
32func (a *API) validateSignupParams(ctx context.Context, p *SignupParams) error {
33 config := a.config
34
35 if p.Password == "" {
36 return apierrors.NewBadRequestError(apierrors.ErrorCodeValidationFailed, "Signup requires a valid password")
37 }
38
39 if err := a.checkPasswordStrength(ctx, p.Password); err != nil {
40 return err
41 }
42 if p.Email != "" && p.Phone != "" {
43 return apierrors.NewBadRequestError(apierrors.ErrorCodeValidationFailed, "Only an email address or phone number should be provided on signup.")
44 }
45 if p.Provider == "phone" && !sms_provider.IsValidMessageChannel(p.Channel, config) {
46 return apierrors.NewBadRequestError(apierrors.ErrorCodeValidationFailed, InvalidChannelError)
47 }
48 // PKCE not needed as phone signups already return access token in body
49 if p.Phone != "" && p.CodeChallenge != "" {
50 return apierrors.NewBadRequestError(apierrors.ErrorCodeValidationFailed, "PKCE not supported for phone signups")
51 }
52 if err := validatePKCEParams(p.CodeChallengeMethod, p.CodeChallenge); err != nil {
53 return err
54 }
55
56 return nil
57}
58
59func (p *SignupParams) ConfigureDefaults() {
60 if p.Email != "" {

Callers 2

SignupMethod · 0.95
adminGenerateLinkMethod · 0.95

Calls 4

checkPasswordStrengthMethod · 0.95
NewBadRequestErrorFunction · 0.92
IsValidMessageChannelFunction · 0.92
validatePKCEParamsFunction · 0.85

Tested by

no test coverage detected