Please add `app.get_new_client()` to help with token rotation
From a discussion in #1324, the only safe way to call the client from outside a bolt handler when token rotation is on is to create a new client each time (as the handlers do)
Since Bolt is currently handling all of this for us, it'd be very useful to have a method along the lines of
client = await bolt.get_new_client(team_id)
that means callers do not need to deal with the InstallationStore and such themselves.
Category (place an x in each of the [ ])
- [x] slack_bolt.App and/or its core components
- [x] slack_bolt.async_app.AsyncApp and/or its core components
- [ ] Adapters in slack_bolt.adapter
- [ ] Others
Requirements
Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.
Hi @lexrobin-te thanks for writing in 💯
Currently we recommend to manually run the same rotation logic before utilizing the stored tokens, If you need to use WebClient outside of a handler
This could be a valid feature request but it may require some amount of work on our end to handle all use cases 🤔 we can't commit to this in the short term
For others reading this drop a 👍 if this is a feature you find useful
Thanks @WilliamBergamin, I understand that's the current recommendation and will be doing that in my project, but I'd appreciate this as a feature request to make things easier in the future.
Also, I'd recommend updating the docs on this since they currently say
Bolt for Python supports and will handle token rotation automatically so long as the built-in OAuth functionality is used.
which is only correct when it comes to the handlers 🙂