hamlet auth component for frontend

Usage no npm install needed!

<script type="module">
  import vueHamlet from '';


Vue Hamlet

vue-hamlet is used as authentication for frontend.



Install repository into your project.

> npm install yimian/vue-hamlet --save-dev

Configure setting in your project main.js

import Axios from 'axios';
import { sync } from 'vuex-router-sync';
import auth from 'vue-hamlet';
import router from './router';
import store from './store';

Vue.prototype.$http = Axios; = store;
Vue.router = router;

Vue.use(auth, {
  fetchUser: '',
  appKey: '',

sync(store, router);

:white_check_mark: TODO

  • mod: change VueResource to axios.
  • add: change password function.
  • add: consts(constants) file.


Run demo project with following procedures:

cd demo/
npm install
npm run dev


Default Configuration:

fetchUser: '/api/auth/me',
appKey: '',
authType: 'Bearer',
hamletPrefix: '/api/auth',
authRedirect: '/login',
refreshInterval: 10, // mins
forbiddenRedirect: '/403',
notFoundRedirect: '/404',

You can rewrite default configuration in your project like:

Vue.use(auth, {
  appKey: '',

You can get the common error reason from $auth.consts.