System Information
- Strapi Version: 4.1.12
- Operating System: Windows 10
- Database: sqlite
- Node Version: ‘14.16.0’
- NPM Version: ‘6.14.11’
- Yarn Version: 1.22.10
Hi all,
Hoping someone can shed some light on this for me.
I am trying to store a google API token to state in a strapi controller, so that it will be stored until strapi is restarted.
async getEvents(ctx) {
try {
if ( ctx.state.jwtClientToken ) {console.log(ctx.state.jwtClientToken)} else {
ctx.state.jwtClientToken = "token"
}
} catch (err) {
ctx.throw(500, err)
}
}
But I have to redefine it every time the controller is called, is there any way in strapi of saving things to state or something similar to that? I have considered creating a dataype and storing it in there, but doesn’t really seem like the correct option.
I was hoping to achieve something similar to this:
but have been unable to successfully port this to strapi. Does anyone know any way of achieving this?
Please let me know if I should provide further information.