@centadt/oidc
v2.11.24
Published
``` yarn add cookie-universal-nuxt @centadt/oidc ```
Downloads
96
Readme
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();
}
}