How to use @authx/strategy-email - 4 common examples

To help you get started, we’ve selected a few @authx/strategy-email examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github the-control-group / authx / packages / strategy-openid / src / server / graphql / mutation / authenticateOpenId.ts View on Github external
}

      const authorizationId = v4();

      // Get the credential
      let credential = await authority.credential(tx, token.sub);

      // Try to associate an existing user by email.
      if (
        !credential &&
        authority.details.emailAuthorityId &&
        authority.details.matchesUsersByEmail &&
        token.email &&
        token.email_verified
      ) {
        const emailAuthority = await EmailAuthority.read(
          tx,
          authority.details.emailAuthorityId
        );

        const emailCredential =
          emailAuthority &&
          emailAuthority.enabled &&
          (await emailAuthority.credential(tx, token.email));

        if (emailCredential && emailCredential.enabled) {
          credential = await OpenIdCredential.write(
            tx,
            {
              enabled: true,
              id: v4(),
              userId: emailCredential.userId,
github the-control-group / authx / packages / strategy-openid / src / server / model / OpenIdAuthority.ts View on Github external
public async emailAuthority(
    tx: PoolClient,
    refresh?: boolean
  ): Promise {
    if (!refresh && this._emailAuthority) {
      return this._emailAuthority;
    }

    if (!this.details.emailAuthorityId) {
      return null;
    }

    return (this._emailAuthority = EmailAuthority.read(
      tx,
      this.details.emailAuthorityId
    ));
  }
github the-control-group / authx / packages / tools / src / lib / fixture / authority.ts View on Github external
insert: (tx: PoolClient) =>
      EmailAuthority.write(
        tx,
        {
          id: "0d765613-e813-40e5-9aa7-89f96531364e",
          enabled: true,
          name: "Email",
          description: "The email authority",
          strategy: "email",
          details: {
            privateKey: `-----BEGIN RSA PRIVATE KEY-----
MIICXAIBAAKBgQCfb+nyTPFCntEXbrFPU5DeE0gC4jXRcSFWDfCRgeqeQWqIW9De
MmCj13k0z6fQCiG3FATYosS64wAs+OiyGtu9q/JyUEVIBMF0upDJMA53AFFx+0Fb
/i76JFPTY7SxzvioIFeKRwY8evIRWQWYO95Os6gKBac/x5qiUn5fh2xM+wIDAQAB
AoGAeOPGo24r0LPTHs1TrC5Uvc4o3+bdn70D5dgT/IBhgTVgrZvQt2nDVPfgc2aw
e1HzVnnbYteoC3xrea4R4lnzGpgcvLYyJ+LEAeRNT66u12EHnCjl8OM5Ods79RO2
pSaGBiAlntq9E86DBJ9ma9lL9NXiokCx4h1ph9rqr6T+DMECQQD7zM56evJj8JyV
kyu7m3PGpepqgMtO4LjHlkU9ZP2HRfrq+bl4yWps1TyCTPzaRujXW+hHJBPsTYar
github the-control-group / authx / packages / tools / src / lib / fixture / credential.ts View on Github external
insert: (tx: PoolClient) =>
      EmailCredential.write(
        tx,
        {
          id: "540128ad-7a55-423e-a85c-103677df333c",
          enabled: true,
          authorityId: "0d765613-e813-40e5-9aa7-89f96531364e",
          authorityUserId: "michael.scott@dundermifflin.com",
          userId: "a6a0946d-eeb4-45cd-83c6-c7920f2272eb",
          details: {
            proof: null
          }
        },
        {
          recordId: "43f7df35-4c00-4baf-b175-1914869897d5",
          createdByAuthorizationId: "f0e54748-c7bb-4724-ad8b-7dabb66aafa9",
          createdAt: new Date("2019-03-06T21:07:59.814Z")
        }

@authx/strategy-email

MIT
Latest version published 7 months ago

Package Health Score

67 / 100
Full package analysis