logaretm / villus

🏎 A tiny and fast GraphQL client for Vue.js
https://villus.dev
MIT License
791 stars 31 forks source link

How to renew accessToken with subscription ? #151

Closed rcauquil closed 2 years ago

rcauquil commented 2 years ago

Hi, I'm looking for a way to renew the token using subscription when it has expired and connection is lost. Any tips ?

rcauquil commented 2 years ago

ok I fixed it this way:

connectionParams: async () => {
    let accessToken = await authPlugin.getThrottledTokenSilently()
    return {
       headers: {
           Authorization: `Bearer ${accessToken}`
       }
    }
}