@byu-oit/nuxt-byu-auth
Setup
Install
:warning: Requires Nuxt version >= 2.13 :warning:
Install with yarn:
yarn add @byu-oit/nuxt-byu-auth
Install with npm:
npm install @byu-oit/nuxt-byu-auth
nuxt.config.js
module.exports = {
modules: [
'@nuxt/axios',
'@byu-oit/nuxt-alerts',
'@byu-oit/nuxt-byu-auth',
],
}
Using Plugin Options
TODO: commit this change
module.exports = {
modules: [
// ... other modules
['@byu-oit/nuxt-byu-auth', {
pluginOptions: {
'implicit-grant': { // configuration for the 'implicit-grant' plugin
usePkce: true, // use PKCE instead of the implicit grant flow
},
}
}]
],
}
Typescript
Add the types to your "types" array in tsconfig.json after the @nuxt/types (Nuxt 2.12.0+)
tsconfig.json
{
"compilerOptions": {
"types": [
"@nuxt/types",
"@nuxtjs/axios",
"@byu-oit/nuxt-alerts",
"@byu-oit/nuxt-sis-context",
"@byu-oit/nuxt-byu-auth"
]
}
}
Why?
Because of the way nuxt works the
$axiosproperty on the context has to be merged into the nuxtContextinterface via declaration merging. Adding@byu-oit/nuxt-byu-authto your types will import the types from the package and make typescript aware of the additions to theContextinterface.
Usage
Set the implicit auth environment variable in the nuxt.config file:
{
publicRuntimeConfig: {
oauthCallbackUrl: process.env.OAUTH_CALLBACK_URL,
oauthClientId: process.env.OAUTH_CLIENT_ID,
baseUrl: process.env.OAUTH_BASE_URL, // defaults to https://api.byu.edu
autoRefreshOnTimeout: process.env.AUTO_REFRESH_ON_TIMEOUT // optional
}
}
Related Packages
Version History
| Version | Released | License |
|---|---|---|
| 3.1.2 | Apache-2.0 | |
| 3.1.0 | Apache-2.0 | |
| 3.0.0 | Apache-2.0 | |
| 2.0.4 | Apache-2.0 | |
| 2.0.3 | Apache-2.0 | |
| 2.0.2 | Apache-2.0 | |
| 2.0.1 | Apache-2.0 | |
| 2.0.0 | Apache-2.0 | |
| 1.1.9 | Apache-2.0 | |
| 1.1.8 | Apache-2.0 | |
| 1.1.7 | Apache-2.0 | |
| 1.1.6 | Apache-2.0 | |
| 1.1.5 | Apache-2.0 | |
| 1.1.4 | Apache-2.0 | |
| 1.1.3 | Apache-2.0 | |
| 1.1.2 | Apache-2.0 | |
| 1.1.1 | Apache-2.0 | |
| 1.1.0 | Apache-2.0 | |
| 1.0.7 | Apache-2.0 | |
| 1.0.5 | Apache-2.0 | |
| 1.0.4 | Apache-2.0 | |
| 1.0.3 | Apache-2.0 | |
| 1.0.2 | Apache-2.0 | |
| 1.0.1 | Apache-2.0 | |
| 1.0.0 | Apache-2.0 | |
| 0.0.13 | Apache-2.0 | |
| 0.0.12 | Apache-2.0 | |
| 0.0.11 | Apache-2.0 | |
| 0.0.10 | Apache-2.0 | |
| 0.0.9 | Apache-2.0 |
Showing the latest 30 of 38. See every release on npm
Pre-releases (1)
| Version | Released | License |
|---|---|---|
| 0.0.4-0 | Apache-2.0 |