Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ruanitto/adonis-oauth2-provider

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ruanitto/adonis-oauth2-provider

Adonis OAuth2 Provider

  • 0.0.7-beta
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

adonis-oauth2-provider

BETA

Implemented: password grant refresh_token grant

Configurations

In auth.js add:

  oauth2: {
    keysPath: Env.get('APP_OAUTHKEY_PATH', 'authkeys'),
    serializer: 'lucidOAuth2', // Can be lucidOAuth2 OR databaseOAuth2
    model: 'App/Models/User',
    scheme: 'oauth2',
    uid: 'email',
    password: 'password',
    refreshTokenLifetime: '14d', // Refresh Token Duration
    allowExtendedTokenAttributes: false,
    requireClientAuthentication: true,
    alwaysIssueNewRefreshToken: true, // Revoke old refresh token
    options: {
      algorithm: 'RS256',
      secret: fs.existsSync(Env.get('APP_OAUTHKEY_PATH', 'authkeys') + '/oauth-private.key') ? fs.readFileSync(Env.get('APP_OAUTHKEY_PATH', 'authkeys') + '/oauth-private.key') : Logger.error('OAuth Keys not found! Please, run `adonis oauth:key` to generate.'),
      public: fs.existsSync(Env.get('APP_OAUTHKEY_PATH', 'authkeys') + '/oauth-public.key') ? fs.readFileSync(Env.get('APP_OAUTHKEY_PATH', 'authkeys') + '/oauth-public.key') : Logger.error('OAuth Keys not found! Please, run `adonis oauth:key` to generate.'),
      expiresIn: Env.get('TOKEN_EXPIRE', '15d'),
      notBefore: 0
    },
    routes_config: {
      register_routes: false, // Define if provider register oauth/token route
      use_prefix: false, // Define if oauthProvider add prefix before oauth/token route
      prefix: null
    }
  }

'@ruanitto/adonis-oauth2-provider/providers/OAuth2Provider' - Auth Provider

Model

Scope

static scopeFindForOAuth2(builder, username) {
    ...function for search
}

validation

validateForOAuth2(password) {
    ...function for validation
}

Custom route Use auth.token() inside route, ex:

Route.post('token', ({ auth }) => {
  return auth.token()
})

TODO authorization_code grant client_credentials grant

Routes auto instalation instructions

Keywords

FAQs

Package last updated on 04 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc