1.6.41 • Published 3 years ago

@boilerz/super-server-auth-core v1.6.41

Weekly downloads
552
License
MIT
Repository
github
Last release
3 years ago

@boilerz/super-server-auth-core

GitHub package.json version GH CI Action codecov

Core module for authentication support on super server

Install

npx install-peerdeps @boilerz/super-server-auth-core

Usage

This plugin add support for a sign up resolver and it is required for other super-server-auth-* plugin. It need a mongo setup to work so the plugin @boilerz/super-server-mongo need to be set before this one.

import { Arg, Query, Resolver } from 'type-graphql';
import * as superServer from '@boilerz/super-server';
import mongoPlugin from '@boilerz/super-server-mongo';
import authCorePlugin from '@boilerz/super-server-auth-core';

@Resolver()
class GreetingResolver {
  @Query(() => String)
  public hello(@Arg('name') name: string): string {
    return `Hello ${name}`;
  }
}

superServer
  .start({
    resolvers: [GreetingResolver],
    plugins: [mongoPlugin, authCorePlugin], // <-- Plugin here (after mongoPlugin)
  })
  .catch(console.error);

In situation example with local auth plugin example

If mail support is not disabled (@see DISABLE_MAILING_SUPPORT below) the worker process defined below should be setup:

node node_modules/@boilerz/super-server-auth-core/worker/email

Release

yarn version
yarn build
yarn publish dist --access public

Env vars

Web plugin

NameDefaultDescription
JWT_SECRETMath.random().toString(36)JWT secret
JWT_EXPIRE_IN30 * 60 * 1000Token expiration in seconds.
DISABLE_MAILING_SUPPORTfalseDisable mailing support.
EXTERNAL_PROVIDER_LINK_CODE_EXPIRES_DURATION2External provider link code expiration in hours.
EMAIL_VALIDATION_EXPIRES_DURATION48Validation code expiration in hours.
AMQP_URLamqp://localhostAMQP url (used for communication between the plugin and the email validation worker).

Email validation worker

NameDefaultDescription
SENDGRID_API_KEYSendgrid API Key for email validation.
SENDER_EMAILSendgrid sender email (must be validated by sendgrid).
EMAIL_VALIDATION_TEMPLATE_IDSendgrid validation email template id. (Must handle firstName, lastName and validationUrl as template data).
LINK_ACCOUNT_TEMPLATE_IDSendgrid link account template id. (Must handle firstName, lastName and linkCode as template data).
WAITING_DURATION_BEFORE_NEXT_EMAIL_ATTEMPT5000Waiting duration in ms between two email validation attempt.
AMQP_URLamqp://localhostSee above
1.6.40

3 years ago

1.6.41

3 years ago

1.6.39

3 years ago

1.6.37

3 years ago

1.6.38

3 years ago

1.6.36

4 years ago

1.6.35

4 years ago

1.6.34

4 years ago

1.6.33

4 years ago

1.6.31

4 years ago

1.6.32

4 years ago

1.6.30

4 years ago

1.6.29

4 years ago

1.6.28

4 years ago

1.6.27

4 years ago

1.6.26

4 years ago

1.6.25

4 years ago

1.6.24

4 years ago

1.6.22

4 years ago

1.6.23

4 years ago

1.6.20

4 years ago

1.6.21

4 years ago

1.6.19

4 years ago

1.6.18

4 years ago

1.6.17

4 years ago

1.6.16

4 years ago

1.6.15

4 years ago

1.6.14

4 years ago

1.6.11

4 years ago

1.6.13

4 years ago

1.6.12

4 years ago

1.6.10

4 years ago

1.6.9

4 years ago

1.6.8

4 years ago

1.6.7

4 years ago

1.6.6

4 years ago

1.6.5

4 years ago

1.6.4

4 years ago

1.6.3

4 years ago

1.6.2

4 years ago

1.6.1

4 years ago

1.6.0

4 years ago

1.5.4

5 years ago

1.5.3

5 years ago

1.5.2

5 years ago

1.5.1

5 years ago

1.5.0

5 years ago

1.4.0

5 years ago

1.3.1

5 years ago

1.3.0

5 years ago

1.2.0

5 years ago

1.1.0

5 years ago

1.2.3

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.0.0

5 years ago

1.0.0-alpha.1

5 years ago