Skip to content

Commit

Permalink
removing uncesscessary wrapping code
Browse files Browse the repository at this point in the history
  • Loading branch information
fedden committed Apr 1, 2021
1 parent 23b944b commit 014882d
Showing 1 changed file with 10 additions and 29 deletions.
39 changes: 10 additions & 29 deletions supabase_py/lib/auth_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,19 @@ class SupabaseAuthClient(gotrue.Client):

def __init__(
self,
auth_url: str,
detect_session_url: bool = False,
url: str,
detect_session_in_url: bool = False,
auto_refresh_token: bool = False,
persist_session: bool = False,
local_storage: Optional[Dict[str, Any]] = None,
headers: Dict[str, str] = {},
):
"""Instanciate SupabaseAuthClient instance."""
super().__init__(auth_url)
self.headers = headers
self.detect_session_url = detect_session_url
self.auto_refresh_token = auto_refresh_token
self.persist_session = persist_session
self.local_storage = local_storage
self.jwt = None

def sign_in(self, email: str, password: str) -> Dict[str, Any]:
"""Sign in with email and password."""
response = super().sign_in(credentials={"email": email, "password": password})
# TODO(fedden): Log JWT to self.jwt
return response.json()

def sign_up(self, email: str, password: str) -> Dict[str, Any]:
"""Sign up with email and password."""
response = super().sign_up(credentials={"email": email, "password": password})
# TODO(fedden): Log JWT to self.jwt
return response.json()

def sign_out(self) -> Dict[str, Any]:
"""Sign out of logged in user."""
if self.jwt is None:
raise ValueError("Cannot sign out if not signed in.")
response = super().sign_out(jwt=self.jwt)
self.jwt = None
return response.json()
super().__init__(
url=url,
headers=headers,
detect_session_in_url=detect_session_in_url,
auto_refresh_token=auto_refresh_token,
persist_session=persist_session,
local_storage=local_storage,
)

0 comments on commit 014882d

Please sign in to comment.