1.6.41 • Published 2 years ago

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

Weekly downloads
552
License
MIT
Repository
github
Last release
2 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

2 years ago

1.6.41

2 years ago

1.6.39

2 years ago

1.6.37

2 years ago

1.6.38

2 years ago

1.6.36

3 years ago

1.6.35

3 years ago

1.6.34

3 years ago

1.6.33

3 years ago

1.6.31

3 years ago

1.6.32

3 years ago

1.6.30

3 years ago

1.6.29

3 years ago

1.6.28

3 years ago

1.6.27

3 years ago

1.6.26

3 years ago

1.6.25

3 years ago

1.6.24

3 years ago

1.6.22

3 years ago

1.6.23

3 years ago

1.6.20

3 years ago

1.6.21

3 years ago

1.6.19

3 years ago

1.6.18

3 years ago

1.6.17

3 years ago

1.6.16

3 years ago

1.6.15

3 years ago

1.6.14

3 years ago

1.6.11

3 years ago

1.6.13

3 years ago

1.6.12

3 years ago

1.6.10

3 years ago

1.6.9

3 years ago

1.6.8

3 years ago

1.6.7

3 years ago

1.6.6

3 years ago

1.6.5

3 years ago

1.6.4

3 years ago

1.6.3

3 years ago

1.6.2

3 years ago

1.6.1

3 years ago

1.6.0

3 years ago

1.5.4

4 years ago

1.5.3

4 years ago

1.5.2

4 years ago

1.5.1

4 years ago

1.5.0

4 years ago

1.4.0

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.1.0

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.0.0

4 years ago

1.0.0-alpha.1

4 years ago