mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
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:
parent
2386be5ef4
commit
62c8d34079
@ -4,7 +4,7 @@ import CONFIG from './../config'
|
|||||||
// Generate an Access Token for the given User ID
|
// Generate an Access Token for the given User ID
|
||||||
export default function encode(user) {
|
export default function encode(user) {
|
||||||
const token = jwt.sign(user, CONFIG.JWT_SECRET, {
|
const token = jwt.sign(user, CONFIG.JWT_SECRET, {
|
||||||
expiresIn: 24 * 60 * 60 * 1000, // one day
|
expiresIn: '1d',
|
||||||
issuer: CONFIG.GRAPHQL_URI,
|
issuer: CONFIG.GRAPHQL_URI,
|
||||||
audience: CONFIG.CLIENT_URI,
|
audience: CONFIG.CLIENT_URI,
|
||||||
subject: user.id.toString(),
|
subject: user.id.toString(),
|
||||||
|
|||||||
@ -271,7 +271,7 @@ module.exports = {
|
|||||||
apollo: {
|
apollo: {
|
||||||
tokenName: 'human-connection-token', // optional, default: apollo-token
|
tokenName: 'human-connection-token', // optional, default: apollo-token
|
||||||
cookieAttributes: {
|
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)
|
// includeNodeModules: true, // optional, default: false (this includes graphql-tag for node_modules folder)
|
||||||
|
|
||||||
|
|||||||
@ -144,10 +144,4 @@ export const actions = {
|
|||||||
commit('SET_TOKEN', null)
|
commit('SET_TOKEN', null)
|
||||||
return this.app.$apolloHelpers.onLogout()
|
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) {},
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user