twitteroauth icon indicating copy to clipboard operation
twitteroauth copied to clipboard

Can I reset the keys / token?

Open christophrumpel opened this issue 6 years ago • 3 comments

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?

christophrumpel avatar Nov 08 '18 09:11 christophrumpel

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?

christophrumpel avatar Nov 08 '18 13:11 christophrumpel

My thought is that changing the consumer key is a large enough change that you should be instantiating a new TwitterOAuth object.

abraham avatar Nov 08 '18 15:11 abraham

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?

christophrumpel avatar Nov 08 '18 15:11 christophrumpel

TwitterOAuth is in maintenance mode and major improvements are no longer planned. https://github.com/abraham/twitteroauth/issues/1188

abraham avatar Jul 24 '23 03:07 abraham

Alright, thanks for the update 👍

christophrumpel avatar Jul 24 '23 06:07 christophrumpel