These are the SDK reference docs. If you’re looking for docs to implement SuperTokens, you might want to check out the User Guides

Module recipe/thirdparty

Index

Type aliases

APIInterface

APIInterface: { appleRedirectHandlerPOST: undefined | ((input: { code: string; options: APIOptions; state: string }) => Promise<void>); authorisationUrlGET: undefined | ((input: { options: APIOptions; provider: TypeProvider }) => Promise<{ status: "OK"; url: string }>); signInUpPOST: undefined | ((input: { authCodeResponse?: any; clientId?: string; code: string; options: APIOptions; provider: TypeProvider; redirectURI: string }) => Promise<{ authCodeResponse: any; createdNewUser: boolean; status: "OK"; user: User } | { status: "NO_EMAIL_GIVEN_BY_PROVIDER" } | { error: string; status: "FIELD_ERROR" }>) }

Type declaration

  • appleRedirectHandlerPOST: undefined | ((input: { code: string; options: APIOptions; state: string }) => Promise<void>)
  • authorisationUrlGET: undefined | ((input: { options: APIOptions; provider: TypeProvider }) => Promise<{ status: "OK"; url: string }>)
  • signInUpPOST: undefined | ((input: { authCodeResponse?: any; clientId?: string; code: string; options: APIOptions; provider: TypeProvider; redirectURI: string }) => Promise<{ authCodeResponse: any; createdNewUser: boolean; status: "OK"; user: User } | { status: "NO_EMAIL_GIVEN_BY_PROVIDER" } | { error: string; status: "FIELD_ERROR" }>)

APIOptions

APIOptions: { appInfo: NormalisedAppinfo; config: TypeNormalisedInput; emailVerificationRecipeImplementation: RecipeInterface; isInServerlessEnv: boolean; providers: TypeProvider[]; recipeId: string; recipeImplementation: RecipeInterface; req: BaseRequest; res: BaseResponse }

Type declaration

RecipeInterface

RecipeInterface: { getUserById: any; getUserByThirdPartyInfo: any; getUsersByEmail: any; signInUp: any }

Type declaration

  • getUserById:function
    • getUserById(input: { userId: string }): Promise<undefined | User>
  • getUserByThirdPartyInfo:function
    • getUserByThirdPartyInfo(input: { thirdPartyId: string; thirdPartyUserId: string }): Promise<undefined | User>
  • getUsersByEmail:function
    • getUsersByEmail(input: { email: string }): Promise<User[]>
  • signInUp:function
    • signInUp(input: { email: { id: string; isVerified: boolean }; thirdPartyId: string; thirdPartyUserId: string }): Promise<{ createdNewUser: boolean; status: "OK"; user: User } | { error: string; status: "FIELD_ERROR" }>
    • Parameters

      • input: { email: { id: string; isVerified: boolean }; thirdPartyId: string; thirdPartyUserId: string }
        • email: { id: string; isVerified: boolean }
          • id: string
          • isVerified: boolean
        • thirdPartyId: string
        • thirdPartyUserId: string

      Returns Promise<{ createdNewUser: boolean; status: "OK"; user: User } | { error: string; status: "FIELD_ERROR" }>

TypeProvider

TypeProvider: { id: string; isDefault?: boolean; get: any }

Type declaration

  • id: string
  • Optional isDefault?: boolean
  • get:function
    • get(redirectURI: undefined | string, authCodeFromRequest: undefined | string): TypeProviderGetResponse

User

User: { email: string; id: string; thirdParty: { id: string; userId: string }; timeJoined: number }

Type declaration

  • email: string
  • id: string
  • thirdParty: { id: string; userId: string }
    • id: string
    • userId: string
  • timeJoined: number

Variables

Error

Error: typeof default = ...

Functions

Apple

  • Apple(config: TypeThirdPartyProviderAppleConfig): TypeProvider

Facebook

  • Facebook(config: TypeThirdPartyProviderFacebookConfig): TypeProvider

Github

  • Github(config: TypeThirdPartyProviderGithubConfig): TypeProvider

Google

  • Google(config: TypeThirdPartyProviderGoogleConfig): TypeProvider

createEmailVerificationToken

  • createEmailVerificationToken(userId: string): Promise<{ status: "OK"; token: string } | { status: "EMAIL_ALREADY_VERIFIED_ERROR" }>

getUserById

  • getUserById(userId: string): Promise<undefined | User>

getUserByThirdPartyInfo

  • getUserByThirdPartyInfo(thirdPartyId: string, thirdPartyUserId: string): Promise<undefined | User>

getUsersByEmail

  • getUsersByEmail(email: string): Promise<User[]>

init

  • init(config: TypeInput): RecipeListFunction

isEmailVerified

  • isEmailVerified(userId: string): Promise<boolean>

revokeEmailVerificationTokens

  • revokeEmailVerificationTokens(userId: string): Promise<{ status: "OK" }>

signInUp

  • signInUp(thirdPartyId: string, thirdPartyUserId: string, email: { id: string; isVerified: boolean }): Promise<{ createdNewUser: boolean; status: "OK"; user: User } | { error: string; status: "FIELD_ERROR" }>
  • Parameters

    • thirdPartyId: string
    • thirdPartyUserId: string
    • email: { id: string; isVerified: boolean }
      • id: string
      • isVerified: boolean

    Returns Promise<{ createdNewUser: boolean; status: "OK"; user: User } | { error: string; status: "FIELD_ERROR" }>

unverifyEmail

  • unverifyEmail(userId: string): Promise<{ status: "OK" }>

verifyEmailUsingToken

  • verifyEmailUsingToken(token: string): Promise<undefined | { status: "EMAIL_VERIFICATION_INVALID_TOKEN_ERROR" } | User>

Generated using TypeDoc