@mosaicapp/nest-js-auth-guard
TypeScript icon, indicating that this package has built-in type declarations

1.4.1 • Public • Published

nestjs-auth-guard

auth-guard lib

What is this repo for:

authorization guard to nestjs server that checks request.header.authorization field

This repo needs npm package

npm install safe-compare --save

How to add this repo to your project

Link this as a submodule

git submodule add https://github.com/LifeCoded/nestjs-auth-guard.git auth-guard

git submodule update --init

Only when this repo changes: Update submodule and push change to remote

git submodule update --remote --recursive

git add auth-guard

git commit

...

Adapt the code

add following code to bootstrap function in main.ts

app.useGlobalGuards(new AuthGuard(configService.getValue('AGENT_API_KEY'),app.get(Reflector)))

Or if configService doesn't exist:

app.useGlobalGuards(new AuthGuard(process.env.AGENT_API_KEY,app.get(Reflector)))

Github Workflow change

replace the previous checkout command with:

    steps:
    - name: Checkout
      uses: actions/checkout@v2
      with:
        token: ${{ secrets.SUBMODULE_FETCH_TOKEN }}
        submodules: recursive

and add SUBMODULE_FETCH_TOKEN in project page

Readme

Keywords

none

Package Sidebar

Install

npm i @mosaicapp/nest-js-auth-guard

Weekly Downloads

22

Version

1.4.1

License

MIT

Unpacked Size

15.8 kB

Total Files

8

Last publish

Collaborators

  • mosaic-raymond
  • khoimosaicapp
  • tianjiliu
  • adit-gajjar
  • jeffrey-mosaic
  • demiwu96
  • jinmok
  • lukemosaic
  • chiwanahn
  • patton_mosaic
  • nima_mosaic