reflex-google-auth 0.0.9a16__py3-none-any.whl → 0.1.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- reflex_google_auth/state.py +20 -1
- {reflex_google_auth-0.0.9a16.dist-info → reflex_google_auth-0.1.1.dist-info}/METADATA +1 -1
- reflex_google_auth-0.1.1.dist-info/RECORD +8 -0
- {reflex_google_auth-0.0.9a16.dist-info → reflex_google_auth-0.1.1.dist-info}/WHEEL +1 -1
- reflex_google_auth-0.0.9a16.dist-info/RECORD +0 -8
- {reflex_google_auth-0.0.9a16.dist-info → reflex_google_auth-0.1.1.dist-info}/top_level.txt +0 -0
reflex_google_auth/state.py
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
import json
|
4
4
|
import os
|
5
5
|
import time
|
6
|
+
from typing import TypedDict
|
6
7
|
|
7
8
|
import reflex as rx
|
8
9
|
from google.auth.transport import requests
|
@@ -21,6 +22,24 @@ def set_client_id(client_id: str):
|
|
21
22
|
CLIENT_ID = client_id
|
22
23
|
|
23
24
|
|
25
|
+
class TokenCredential(TypedDict, total=False):
|
26
|
+
iss: str
|
27
|
+
azp: str
|
28
|
+
aud: str
|
29
|
+
sub: str
|
30
|
+
hd: str
|
31
|
+
email: str
|
32
|
+
email_verified: bool
|
33
|
+
nbf: int
|
34
|
+
name: str
|
35
|
+
picture: str
|
36
|
+
given_name: str
|
37
|
+
family_name: str
|
38
|
+
iat: int
|
39
|
+
exp: int
|
40
|
+
jti: str
|
41
|
+
|
42
|
+
|
24
43
|
async def get_id_token(auth_code) -> str:
|
25
44
|
"""Get the id token credential from an auth code.
|
26
45
|
|
@@ -61,7 +80,7 @@ class GoogleAuthState(rx.State):
|
|
61
80
|
return CLIENT_ID or os.environ.get("GOOGLE_CLIENT_ID", "")
|
62
81
|
|
63
82
|
@rx.var(cache=True)
|
64
|
-
def tokeninfo(self) ->
|
83
|
+
def tokeninfo(self) -> TokenCredential:
|
65
84
|
try:
|
66
85
|
return verify_oauth2_token(
|
67
86
|
json.loads(self.id_token_json)["credential"],
|
@@ -0,0 +1,8 @@
|
|
1
|
+
reflex_google_auth/__init__.py,sha256=A3PO7fwBSKoX2nPN5JohqrnZ1cu9nLaP5JsLR9SjbZI,339
|
2
|
+
reflex_google_auth/decorator.py,sha256=xjlC4AgU5lX4CyTjM67hTQUFIc_0I1JBC8V4CqvJtM0,1763
|
3
|
+
reflex_google_auth/google_auth.py,sha256=PG2QUFcCVQDtUKGqfJ0DabrIOvO6jthNxdXWPPoB-8Y,1696
|
4
|
+
reflex_google_auth/state.py,sha256=reDpgk62rFLmxmXd8lYcgotM8TTZQeMkgsIT2uFK9Z0,2998
|
5
|
+
reflex_google_auth-0.1.1.dist-info/METADATA,sha256=I2BYS5H0Ny-uNRez4fvFwBj9DuXj0FTTkcgUlQZ-s7Q,4859
|
6
|
+
reflex_google_auth-0.1.1.dist-info/WHEEL,sha256=52BFRY2Up02UkjOa29eZOS2VxUrpPORXg1pkohGGUS8,91
|
7
|
+
reflex_google_auth-0.1.1.dist-info/top_level.txt,sha256=JB7Letu_7VOfOx5EhyGn_bElQjzSq43-LHafE90wqyM,19
|
8
|
+
reflex_google_auth-0.1.1.dist-info/RECORD,,
|
@@ -1,8 +0,0 @@
|
|
1
|
-
reflex_google_auth/__init__.py,sha256=A3PO7fwBSKoX2nPN5JohqrnZ1cu9nLaP5JsLR9SjbZI,339
|
2
|
-
reflex_google_auth/decorator.py,sha256=xjlC4AgU5lX4CyTjM67hTQUFIc_0I1JBC8V4CqvJtM0,1763
|
3
|
-
reflex_google_auth/google_auth.py,sha256=PG2QUFcCVQDtUKGqfJ0DabrIOvO6jthNxdXWPPoB-8Y,1696
|
4
|
-
reflex_google_auth/state.py,sha256=-rQTvZjkUYiOgYzUkEJNwgMY7V2lgDLA4D94yNUmHQ8,2691
|
5
|
-
reflex_google_auth-0.0.9a16.dist-info/METADATA,sha256=vTPJulQ5n4HyxzzssOvlGTfAAoiyvjjO5BzRc9ZtEOE,4862
|
6
|
-
reflex_google_auth-0.0.9a16.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
|
7
|
-
reflex_google_auth-0.0.9a16.dist-info/top_level.txt,sha256=JB7Letu_7VOfOx5EhyGn_bElQjzSq43-LHafE90wqyM,19
|
8
|
-
reflex_google_auth-0.0.9a16.dist-info/RECORD,,
|
File without changes
|