@centadt/oidc

2,126
Install
npm install @centadt/oidc
Latest Version:2.11.24
License:MIT
Last Updated:Sep 25, 2024
Links: npm
Maintainer: dt000068

Setup

yarn add cookie-universal-nuxt @centadt/oidc

add index.js in "store" folder
add below code snippet in nuxt.config.js

server: { port: 33235 },
modules: [
  'cookie-universal-nuxt',
  '@nuxtjs/axios',
  ['@centadt/oidc', {
    authority: "authority",
    client_id: "clientId",
    redirect_uri: "http://localhost:33235/login",
    post_logout_redirect_uri: "http://localhost:33235/logout",
    silent_redirect_uri: "http://localhost:33235/login",

    scope: "openid profile centanetapi offline_access",
  }]
],
router: {
  middleware: ['route']
},

Code example

login

<button @click="login">login</button>
methods: {
  login() {
    this.$oidc.getOidcManager().signinRedirect({
      prompt: "login",
      extraQueryParams: {
        platform: "web",
      },
    });
  }
}

logout

<button @click="logout">logout</button>
methods: {
  logout() {
    this.$oidc.clearCentaLoginToken();
  }
}

Version History

Version Released License
2.11.24 MIT
2.11.23 MIT
2.11.21 MIT
2.11.19 MIT
2.11.18 MIT