0.0.24 • Published 6 years ago

auth-saverium v0.0.24

Weekly downloads
-
License
ISC
Repository
-
Last release
6 years ago

Auth-Saverium NPM Package

Installation

1. Install package to your app

npm i auth-saverium --save

2. Create oidc configuration file

// oidc.js
export const oidcSettings = {
    authority: 'https://auth.saverium.com/openid/',
    client_id: '049817',
    redirect_uri: 'http://localhost:8080/oidc-callback',
    response_type: 'code',
    scope: 'code',
    localAuthUrl: 'http://localhost:3000/token'
  }

3. Create oidc Vuex module

// in the file you define your other store modules
import Vue from 'vue'
import Vuex from 'vuex'
import { createStoreModule } from 'auth-saverium' // Import the module

import { oidcSettings } from './../utils/oidc' // Pointing to a file your created on step 2

Vue.use(Vuex)

const oidc = createStoreModule(oidcSettings)

export const store = new Vuex.Store({
  modules: {
    oidc: oidc, // Add it as one of the modules
  }
})

4. Add OidcCallback route

  path: '/oidc-callback', // Needs to match redirect_uri in you oidcSettings
  name: 'oidcCallback',
  component: OidcCallback,
  meta: {
    isOidcCallback: true
  }

5. Create corresponding OidcCallback component

<template>
  <div>
  </div>
</template>

<script>
import { mapActions } from 'vuex'

export default {
  name: 'OidcCallback',
  methods: {
    ...mapActions([
      'oidcSignInCallback'
    ])
  },
  mounted() {
    this.oidcSignInCallback()
      .then((data) => {
        // Data is the route name what was originally requested
        // Handle it here
        // For example import router and do redirect
      })
      .catch((err) => {
        // Handle errors
      })
  }
}
</script>

Build and publish

Update version number accordingly on package.json

npm run build
0.0.24

6 years ago

0.0.23

6 years ago

0.0.22

6 years ago

0.0.21

6 years ago

0.0.20

6 years ago

0.0.19

6 years ago

0.0.18

6 years ago

0.0.17

6 years ago

0.0.16

6 years ago

0.0.15

6 years ago

0.0.14

6 years ago

0.0.13

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago