twitteroauth
twitteroauth copied to clipboard
Can I reset the keys / token?
Hey Abraham. Thanks for this great package. Been using quite long for my Laravel Notifications package. 👍
I was wondering if it's possible to reset the consumer keys and auth tokens. Until now I have just created a new OAuth object, but for testing, I would prefer to just change it through a method. It should probably work by doing the same that happens in the constructor, but what do you think about adding a method where I can just pass the keys and tokens again like with the constructor?
Ok, actually I can't reset it myself. I can set the oauth tokens, because this method is public, but not the consumer method. So right now is no way to change the consumer keys without creating a new object right?
My thought is that changing the consumer key is a large enough change that you should be instantiating a new TwitterOAuth object.
Hmm yeah I get you point here. My problem with this is, that I have mocked the oauth object which I provide it in a class constructor. Now when the user wants to change the settings, I need to create a new object which I can't properly mock.
With Laravel notifications, the settings can be overridden on a per-user level. So changing the keys a common approach.
So maybe this could be helpful to others as well? Would you accept a PR with a reset method or don't you want that addition at all?
TwitterOAuth is in maintenance mode and major improvements are no longer planned. https://github.com/abraham/twitteroauth/issues/1188
Alright, thanks for the update 👍