How to use the @authx/strategy-email.EmailAuthority.read function in @authx/strategy-email

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
    ));
  }

@authx/strategy-email

MIT
Latest version published 7 months ago

Package Health Score

67 / 100
Full package analysis