Gathering detailed insights and metrics for vue-axios-jwt
Gathering detailed insights and metrics for vue-axios-jwt
Gathering detailed insights and metrics for vue-axios-jwt
Gathering detailed insights and metrics for vue-axios-jwt
npm install vue-axios-jwt
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
5 Stars
50 Commits
2 Watching
12 Branches
1 Contributors
Updated on 04 Apr 2021
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
-88.9%
1
Compared to previous week
Last month
-40%
15
Compared to previous month
Last year
-46.9%
375
Compared to previous year
1
Vue Wrapper For Axios-Jwt
The endpoint to obtain a new access token using the
refresh token. (e.x. /api/v1/auth/token/refresh/
)
The endpoint to log the user in via some kind of
credentials. (e.x. /api/v1/auth/login
)
The axios instance you want to use for making calls to the API.
If one is not specified, then it will create an instance
via axios.create()
.
This is useful if you want to specify a different base URL or some other axios configurations.
A callable object which takes an AxiosResponse and
returns an object such as {accessToken: 'string', refreshToken: 'string'}
.
The default implementation is:
typescript
1import {AxiosResponse} from 'axios'; 2import {IAuthTokens} from 'axios-jwt'; 3 4const defaultTransformer = (response: AxiosResponse): IAuthTokens => ({ 5 accessToken: response.data.access_token, 6 refreshToken: response.data.refresh_token 7});
Or if you prefer ES6...
javascript
1const defaultTransformer = (response) => ({ 2 accessToken: response.data.access_token, 3 refreshToken: response.data.refresh_token 4})
1import Vue from 'vue'; 2import VueAxiosJwt from 'vue-axios-jwt'; 3 4Vue.use(VueAxiosJwt); 5 6const axiosJwtHandler = new AxiosJwtHandler({refresh_endpoint: '/api/v1/auth/token/refresh/'}); 7 8const app = new Vue({ 9 // ... other junk 10 axiosJwtHandler 11}).$mount('#app');
1<template> 2 <div> 3 <span>Hello {{ user }}</span> 4 </div> 5</template> 6 7<script> 8export default { 9 name: 'Example', 10 data() { 11 return { 12 user: '' 13 } 14 }, 15 mounted() { 16 this.$axios.get('/api/v1/user/') 17 .then(response => { this.user = response.data.user }); 18 } 19} 20</script>
1/** 2* src/apiClient.js 3*/ 4import AxiosJwtHandler from 'vue-axios-jwt'; 5const handler = new AxiosJwtHandler({refresh_endpoint: '/api/v1/auth/refresh/'}); 6export default handler.instance;
1/** 2* src/main.js 3*/ 4import apiClient from './apiClient'; 5apiClient.post('/api/v1/something/', {data: {ayy: 'lmao'}});
The above structure is nice when you have your vuex store in different modules and need to make XHR requests within the actions.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
46 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More