Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add remove_client method to base_client.registry.BaseOAuth #585

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add remove_client method to base_client.registry.BaseOAuth
  • Loading branch information
lcdunne committed Sep 23, 2023
commit 5bb160f081068db46c7eff29c057f7cafbad3b05
10 changes: 10 additions & 0 deletions authlib/integrations/base_client/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,16 @@ def register(self, name, overwrite=False, **kwargs):
self._registry[name] = (overwrite, kwargs)
return self.create_client(name)

def remove_client(self, name):
if name not in self._registry:
raise KeyError(f"Client {name} not found in registry.")

if name not in self._clients:
raise KeyError(f"Client {name} not found in clients.")

del self._registry[name]
del self._clients[name]

def generate_client_kwargs(self, name, overwrite, **kwargs):
fetch_token = kwargs.pop('fetch_token', None)
update_token = kwargs.pop('update_token', None)
Expand Down