Refresh Token
i-am-pumz opened this issue · 3 comments
Hi,
First, thank you very much for this module!
Is there any current support for refresh tokens? My access token is not fixed, and should be refreshed (around) every 10 minutes.
When the access token is expired, the client should make a new authToken()
request and get a new access
token.
I'm trying to figure out if it's possible to handle such errors (token expired
) on the project level (such as some kind of error interceptor)? Or is this module is made to deal differently with such cases?
My (relevant) nuxt.config.js
buildModules: [
// https://go.nuxtjs.dev/typescript
'@nuxt/typescript-build',
// https://go.nuxtjs.dev/vuetify
'@nuxtjs/vuetify',
// https://github.com/Gomah/nuxt-graphql-request
'nuxt-graphql-request',
],
graphql: {
/**
* Your GraphQL endpoint
*/
endpoint: 'http://localhost:8000/graphql',
/**
* Options
* See: https://github.com/prisma-labs/graphql-request#passing-more-options-to-fetch
*/
options: {},
/**
* Optional
* default: true (this includes cross-fetch/polyfill before creating the graphql client)
*/
useFetchPolyfill: true,
/**
* Optional
* default: false (this includes graphql-tag for node_modules folder)
*/
includeNodeModules: true,
},
my project dependencies:
"dependencies": {
"@nuxt/typescript-runtime": "^2.0.0",
"@nuxtjs/axios": "^5.12.2",
"@nuxtjs/pwa": "^3.0.2",
"core-js": "^3.6.5",
"graphql-tag": "^2.11.0",
"nuxt": "^2.14.6",
"vue-class-component": "^7.2.6",
"vue-property-decorator": "^9.1.2",
"vuex-class-component": "^2.3.5"
},
"devDependencies": {
"@nuxt/types": "^2.14.6",
"@nuxt/typescript-build": "^2.0.3",
"@nuxtjs/eslint-config": "^3.1.0",
"@nuxtjs/eslint-config-typescript": "^3.0.0",
"@nuxtjs/eslint-module": "^2.0.0",
"@nuxtjs/vuetify": "^1.11.2",
"@wdio/cli": "^6.5.2",
"@wdio/local-runner": "^6.5.2",
"@wdio/mocha-framework": "^6.5.0",
"@wdio/spec-reporter": "^6.4.7",
"@wdio/sync": "^6.5.0",
"babel-eslint": "^10.1.0",
"eslint": "^7.10.0",
"eslint-config-prettier": "^6.12.0",
"eslint-plugin-nuxt": "^1.0.0",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-wdio": "^6.0.12",
"graphql": "^15.4.0",
"nuxt-graphql-request": "^3.2.0",
"prettier": "^2.1.2",
"webdriverio": "^6.5.2"
}
Yeah I’d like to know the best patten for this too.
Hi @Gomah any updates to this issue? Some kind of interceptor would be really helpful
Hey,
Sorry for the lack of reply, for now, graphql-request
does not have a global error handler, ref: jasonkuhrt/graffle#255