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

Updated notes on using a cache instance when initializing OAuth. #693

Merged
merged 2 commits into from
Dec 18, 2024

Conversation

iSOLveIT
Copy link
Contributor

DO NOT SEND ANY SECURITY FIX HERE. Please read the "Security Reporting" section
on README.

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Other, please describe: Updated Flask OAuth Client documentation.

  • You consent that the copyright of your pull request source code belongs to Authlib's author.

The Flask OAuth Client documentation excludes important information about creating a cache instance for OAuth initialization.

Under FlaskClient framework_integration.py source code,

# File: authlib/integrations/base_client/framework_integration.py

def clear_state_data(self, session, state):
        key = f'_state_{self.name}_{state}'
        if self.cache:
            self.cache.delete(key)   # Calls the delete method on the cache object
        else:
            ...

You are required to have a delete method for the cache object else you get an AttributeError like this AttributeError("'Cache' object has no attribute 'delete'").

This PR updates the documentation to inform users about the need to have a delete method as part of their cache instance.

@lepture lepture merged commit 5a0ca3c into lepture:master Dec 18, 2024
3 checks passed
@lepture
Copy link
Owner

lepture commented Dec 18, 2024

Thanks

@iSOLveIT iSOLveIT deleted the iSOLveIT-cache-init branch December 19, 2024 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants