Add device-bound robot notifications and automatic OAuth cards
This commit is contained in:
@@ -58,6 +58,8 @@ class WorkClient:
|
||||
if self.pending.exists():
|
||||
data = self.read(self.pending)
|
||||
if data.get("owner") == self.owner and data["deadline"] > time.time():
|
||||
from .notification_client import notify_authorization
|
||||
notify_authorization(self, data)
|
||||
return data["authorization_url"]
|
||||
response = self.http.post("/oauth/start", json={"host_id": self.config["host_id"],
|
||||
"proof": self.proof("work-oauth-v1", {})})
|
||||
@@ -68,6 +70,8 @@ class WorkClient:
|
||||
raise WorkError("授权地址必须使用HTTPS。")
|
||||
data.update(owner=self.owner, deadline=time.time() + data["expires_in"])
|
||||
atomic_secret(self.pending, data)
|
||||
from .notification_client import notify_authorization
|
||||
notify_authorization(self, data)
|
||||
return data["authorization_url"]
|
||||
|
||||
def save_tokens(self, data):
|
||||
|
||||
Reference in New Issue
Block a user