(20241125) Testing OAuth2.0 with Google.
This commit is contained in:
@@ -41,6 +41,9 @@ import io
|
||||
# For defining the class's structure:
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
# For working with datatypes:
|
||||
from typing import List
|
||||
|
||||
# For debugging:
|
||||
from icecream import IceCreamDebugger
|
||||
|
||||
@@ -115,6 +118,41 @@ class OAuthBase(ABC):
|
||||
def debug_everything(self):
|
||||
self._debug_only_errors = False
|
||||
|
||||
# ┏┓┓ ┳┳┓ ┓ ┓
|
||||
# ┣┫┣┓┏╋┏┓┏┓┏╋ ┃┃┃┏┓╋┣┓┏┓┏┫┏
|
||||
# ┛┗┗┛┛┗┛ ┗┻┗┗ ┛ ┗┗ ┗┛┗┗┛┗┻┛
|
||||
|
||||
@abstractmethod
|
||||
async def initialize(
|
||||
self,
|
||||
scopes: List
|
||||
) -> bool:
|
||||
|
||||
"""
|
||||
To initialize the service-specific OAuth2.0 class. For example, in Google's case, we need to initialize an app
|
||||
flow that was created for an app through its Cloud Console panel.
|
||||
:param scopes: The list of permissions being requested. The word 'scopes' has been borrowed from Google's OAuth
|
||||
documentation (which was implemented first).
|
||||
:return: True if the initialization succeeded, False if it failed.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
async def get_authorization_url(
|
||||
self,
|
||||
**kwargs
|
||||
) -> str | None:
|
||||
|
||||
"""
|
||||
To create an authorization URL which will be then sent to the front-end for the user to click and grant/decline
|
||||
various permissions.
|
||||
:param kwargs: The identifiers of the user who wants to use your service (where your service needs access to
|
||||
their second-party account).
|
||||
:return: The authorization URL if successful, or None if failed.
|
||||
"""
|
||||
|
||||
pass
|
||||
|
||||
|
||||
# *****************************************************************************************************************
|
||||
# ***** ****
|
||||
|
||||
Reference in New Issue
Block a user