Fix expiration dates of JWT and cookie

This won't fix the bug that can happen in `nuxtServerInit`. However,
according to the docs, we accepted JWT which was valid for 1000 days and
our cookie was valid for 3 days - completely weird.

See:
https://github.com/auth0/node-jsonwebtoken
https://github.com/nuxt-community/apollo-module
This commit is contained in:
roschaefer 2019-08-22 20:21:40 +02:00
parent 2386be5ef4
commit 62c8d34079
3 changed files with 2 additions and 8 deletions

View File

@ -4,7 +4,7 @@ import CONFIG from './../config'
// Generate an Access Token for the given User ID
export default function encode(user) {
const token = jwt.sign(user, CONFIG.JWT_SECRET, {
expiresIn: 24 * 60 * 60 * 1000, // one day
expiresIn: '1d',
issuer: CONFIG.GRAPHQL_URI,
audience: CONFIG.CLIENT_URI,
subject: user.id.toString(),

View File

@ -271,7 +271,7 @@ module.exports = {
apollo: {
tokenName: 'human-connection-token', // optional, default: apollo-token
cookieAttributes: {
expires: 3, // optional, default: 7 (days)
expires: 1, // optional, default: 7 (days)
},
// includeNodeModules: true, // optional, default: false (this includes graphql-tag for node_modules folder)

View File

@ -144,10 +144,4 @@ export const actions = {
commit('SET_TOKEN', null)
return this.app.$apolloHelpers.onLogout()
},
register({ dispatch, commit }, { email, password, inviteCode, invitedByUserId }) {},
async patch({ state, commit, dispatch }, data) {},
resendVerifySignup({ state, dispatch }) {},
resetPassword({ state }, data) {},
setNewPassword({ state }, data) {},
}