![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
[![npm](https://badgen.net/npm/v/druxt-auth)](https://www.npmjs.com/package/druxt-auth) [![CI](https://github.com/druxt/druxt-auth/actions/workflows/ci.yml/badge.svg)](https://github.com/druxt/druxt-auth/actions/workflows/ci.yml) [![Known Vulnerabilities]
Druxt Authentication with Drupal Simple OAuth2 and nuxt/auth.
$ npm install druxt-auth
Add module to nuxt.config.js
module.exports = {
buildModules: [
'druxt',
['druxt-auth', {
clientId: '[DRUPAL_CONSUMER_UUID]',
clientSecret: '[DRUPAL_CONSUMER_SECRET]',
scope: ['default'],
}]
],
druxt: {
baseUrl: 'https://demo-api.druxtjs.org'
},
}
Note: Replace [DRUPAL_CONSUMER_UUID]
and [DRUPAL_CONSUMER_SECRET]
with the details from the consumer created in the following step.
Download, install and setup the Simple OAuth module.
Create a Consumer depending on your desired authorization strategy:
Authorization Code grant:
[FRONTEND_URL]/callback
(e.g., http://localhost:3000/callback
)Password grant:
[FRONTEND_URL]/callback
(e.g., http://localhost:3000/callback
)The DruxtAuth module installs and configures the nuxt/auth module for your Druxt site.
It adds two auth strategies that can be used via the $auth
plugin:
drupal-authorization_code
this.$nuxt.$auth.loginWith('drupal-authorization_code')
drupal-password
this.$nuxt.$auth.loginWith('drupal-password', {
data: {
username: '',
password: ''
}
})
Note: Nuxt must be running in SSR mode for password grant, and client secret must be set.
See the nuxt/auth documentation form more details: https://auth.nuxtjs.org/api/auth
Option | Type | Required | Default | Description |
---|---|---|---|---|
clientId | string | Yes | undefined | The Drupal Consumer UUID |
clientSecret | string | No | undefined | The Drupal Consumer API secret. Required for Password grant. |
scope | array | No | undefined | The OAuth Scopes to be used for the Drupal Consumer. |
FAQs
[![npm](https://badgen.net/npm/v/druxt-auth)](https://www.npmjs.com/package/druxt-auth) [![CI](https://github.com/druxt/druxt-auth/actions/workflows/ci.yml/badge.svg)](https://github.com/druxt/druxt-auth/actions/workflows/ci.yml) [![Known Vulnerabilities]
The npm package druxt-auth receives a total of 16 weekly downloads. As such, druxt-auth popularity was classified as not popular.
We found that druxt-auth demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.