Skip to content

Commit

Permalink
Test initial stubs against gotrue-example site
Browse files Browse the repository at this point in the history
  • Loading branch information
Joel Lee authored and Joel Lee committed Jan 25, 2021
1 parent 0e4fbd0 commit 583da03
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 9 deletions.
2 changes: 1 addition & 1 deletion gotrue_py/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ def __init__(self):
self.user = user

def listUsers(aud):
return requests.get()
return requests.post()

def getUser(self,user):
pass
Expand Down
43 changes: 37 additions & 6 deletions gotrue_py/client.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,36 @@
import requests
import user
import re
import urllib
import json
HTTPRegexp = /^http:\/\//;
defaultApiURL = "/.netlify/identity"

class Client:
def __init__(url, audience='', setCookie=False):
pass

def _request():
pass
if re.match(HTTPRegexp):
# TODO: Decide whether to convert this to a logging statement
print("Warning:\n\nDO NOT USE HTTP IN PRODUCTION FOR GOTRUE EVER!\nGoTrue REQUIRES HTTPS to work securely.")
if audience:
self.audience = audience
self.setCookie = setCookie
self.BASE_URL = "https://distracted-elion-6bf6a2.netlify.app/.netlify/identity/"
def _request(path, options=[]):
options = option.headers or []
aud = options.audience or self.audience
if aud:
options.headers['X-JWT-AUD'] = aud


def settings():
pass

def signup(email, password, data):
pass
data = json.dumps({
"email": "yadayada@gmail.com",
"password": "yadayada"
})
requests.post("https://distracted-elion-6bf6a2.netlify.app/.netlify/identity/signup", data)

def login():
pass
Expand Down Expand Up @@ -39,8 +60,18 @@ def currentUser():
pass

def verify(type, token, remember):
requests.post("https://distracted-elion-6bf6a2.netlify.app/.netlify/identity/verify",data=json.dumps({"type": "signup", "token": "cixoe6C7k1tqx2UuYL_O3w"}))
pass

def _setRememberHeaders(remember):
pass
if self.setCookie:
self.api.defaultHeaders = self.api.defaultHeaders or {};
self.api.defaultHeaders['X-Use-Cookie'] = remember ? '1' : 'session';

def grant_token(type, payload):
payload = json.dumps({
"email": "yadayada@gmail.com",
"password": "yadayada"
})
headers = { 'Content-Type': 'application/x-www-form-urlencoded' }
requests.post("https://distracted-elion-6bf6a2.netlify.app/.netlify/identity/verify",data=json.dumps({"type": "signup", "token": "tokenthing"}))
7 changes: 5 additions & 2 deletions gotrue_py/user.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
class User:
def __init__(api, tokenRepsonse, audience):
pass
self.api = api
self.url = api.apiURL
self._processTokenResponse(tokenResponse)
currentUser = self

@staticmethod
def removeSavedSession():
pass
# isBrowser()

@staticmethod
def recoverSession():
Expand Down

0 comments on commit 583da03

Please sign in to comment.