@authllizer/vue
TypeScript icon, indicating that this package has built-in type declarations

0.2.0 • Public • Published

Vue Authllizer Plugin

Source Code Version MIT License Bundle Size TypeScript

This plugin is a wrapper of Authllizer for comfortable using it in VueJs.

Example

There are VueJs example project in the source code.

Install

$ npm install --save @authllizer/vue
# and install peer dependencies 
$ npm install --save @authllizer/core

Setup

    import Vue from 'vue';
    import { default as VueAuthllizer } from '@authllizer/vue';
    import { IAuthllizerOptions } from '@authllizer/core';

    Vue.use(VueAuthllizer, {
        // ...
    } as IAuthllizerOptions);

Use

    import Vue from 'vue';
    import { Authllizer } from '@authllizer/core';

    class SomeComponent extends Vue {
        doSomething(){
            let auth: Authllizer = this.$auth;
        }
    }

Http Client

You can use another library as http client see in the doc HttpClient.

vue-axios

    import Vue from 'vue';
    import { IAuthllizerOptions } from '@authllizer/core';
    import VueAuthllizer, {  VueAxiosHttpClient } from '@authllizer/vue';
    import axios from 'axios';
    import * as VueAxios from 'vue-axios';

    Vue.use(VueAxios, axios);
    Vue.use(VueAuthllizer, {
        httpClient: new VueAxiosHttpClient
        // ...
    } as IAuthllizerOptions)

interceptor

    import { VueAxiosTokenInterceptor } from '@authllizer/vue';
    import Vue from 'vue';

    Vue.axios.interceptors.request.use(VueAxiosTokenInterceptor);

vue-resource

    import Vue from 'vue';
    import { IAuthllizerOptions } from '@authllizer/core';
    import VueAuthllizer from '@authllizer/vue';
    import * as VueResource from 'vue-resource';
    
    Vue.use(VueResource);
    Vue.use(VueAuthllizer, {...} as IAuthllizerOptions);

interceptor

    import { VueResourceTokenInterceptor } from '@authllizer/vue';
    import Vue from 'vue';
    Vue.resource.interceptors.push(VueResourceTokenInterceptor);

License

Copyright © 2017 Yisrael Eliav, Licensed under the MIT license.

/@authllizer/vue/

    Package Sidebar

    Install

    npm i @authllizer/vue

    Weekly Downloads

    12

    Version

    0.2.0

    License

    MIT

    Unpacked Size

    79.8 kB

    Total Files

    71

    Last publish

    Collaborators

    • yisraelx