reflex-google-auth 0.0.9a16__tar.gz → 0.1.1__tar.gz

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.
Files changed (23) hide show
  1. {reflex_google_auth-0.0.9a16 → reflex_google_auth-0.1.1}/.github/workflows/pre-commit.yaml +4 -3
  2. {reflex_google_auth-0.0.9a16 → reflex_google_auth-0.1.1}/.github/workflows/publish.yml +2 -2
  3. {reflex_google_auth-0.0.9a16 → reflex_google_auth-0.1.1}/PKG-INFO +1 -1
  4. {reflex_google_auth-0.0.9a16 → reflex_google_auth-0.1.1}/custom_components/reflex_google_auth/state.py +20 -1
  5. {reflex_google_auth-0.0.9a16 → reflex_google_auth-0.1.1}/custom_components/reflex_google_auth.egg-info/PKG-INFO +1 -1
  6. {reflex_google_auth-0.0.9a16 → reflex_google_auth-0.1.1}/google_auth_demo/google_auth_demo/google_auth_demo.py +1 -1
  7. {reflex_google_auth-0.0.9a16 → reflex_google_auth-0.1.1}/.gitignore +0 -0
  8. {reflex_google_auth-0.0.9a16 → reflex_google_auth-0.1.1}/.pre-commit-config.yaml +0 -0
  9. {reflex_google_auth-0.0.9a16 → reflex_google_auth-0.1.1}/README.md +0 -0
  10. {reflex_google_auth-0.0.9a16 → reflex_google_auth-0.1.1}/custom_components/reflex_google_auth/__init__.py +0 -0
  11. {reflex_google_auth-0.0.9a16 → reflex_google_auth-0.1.1}/custom_components/reflex_google_auth/decorator.py +0 -0
  12. {reflex_google_auth-0.0.9a16 → reflex_google_auth-0.1.1}/custom_components/reflex_google_auth/google_auth.py +0 -0
  13. {reflex_google_auth-0.0.9a16 → reflex_google_auth-0.1.1}/custom_components/reflex_google_auth.egg-info/SOURCES.txt +0 -0
  14. {reflex_google_auth-0.0.9a16 → reflex_google_auth-0.1.1}/custom_components/reflex_google_auth.egg-info/dependency_links.txt +0 -0
  15. {reflex_google_auth-0.0.9a16 → reflex_google_auth-0.1.1}/custom_components/reflex_google_auth.egg-info/requires.txt +0 -0
  16. {reflex_google_auth-0.0.9a16 → reflex_google_auth-0.1.1}/custom_components/reflex_google_auth.egg-info/top_level.txt +0 -0
  17. {reflex_google_auth-0.0.9a16 → reflex_google_auth-0.1.1}/google_auth_demo/.gitignore +0 -0
  18. {reflex_google_auth-0.0.9a16 → reflex_google_auth-0.1.1}/google_auth_demo/assets/favicon.ico +0 -0
  19. {reflex_google_auth-0.0.9a16 → reflex_google_auth-0.1.1}/google_auth_demo/google_auth_demo/__init__.py +0 -0
  20. {reflex_google_auth-0.0.9a16 → reflex_google_auth-0.1.1}/google_auth_demo/requirements.txt +0 -0
  21. {reflex_google_auth-0.0.9a16 → reflex_google_auth-0.1.1}/google_auth_demo/rxconfig.py +0 -0
  22. {reflex_google_auth-0.0.9a16 → reflex_google_auth-0.1.1}/pyproject.toml +0 -0
  23. {reflex_google_auth-0.0.9a16 → reflex_google_auth-0.1.1}/setup.cfg +0 -0
@@ -4,7 +4,7 @@ on:
4
4
  pull_request:
5
5
  branches: ["main"]
6
6
  push:
7
- branches: ["main", "masenf/deploy"]
7
+ branches: ["main"]
8
8
 
9
9
  jobs:
10
10
  pre-commit:
@@ -15,5 +15,6 @@ jobs:
15
15
  - uses: actions/setup-python@v2
16
16
  with:
17
17
  python-version: "3.12"
18
- - run: pip install pre-commit pyright . -r${{ vars.APP_DIRECTORY }}/requirements.txt
19
- - run: pre-commit run --all-files
18
+ - run: pip install pre-commit pyright .
19
+ - run: find . -name requirements.txt | sed -e 's/^/-r/' | xargs pip install
20
+ - run: pre-commit run --all-files
@@ -3,9 +3,9 @@ name: Publish Component and Deploy Demo App
3
3
  on:
4
4
  release:
5
5
  types: [published]
6
-
6
+
7
7
  env:
8
- EXTRA_ARGS: "--hostname ${{ vars.HOSTNAME }} --env GOOGLE_CLIENT_ID=${{ secrets.GOOGLE_CLIENT_ID }} --env GOOGLE_CLIENT_SECRET=${{ secrets.GOOGLE_CLIENT_SECRET }} --env GOOGLE_REDIRECT_URI=${{ secrets.GOOGLE_REDIRECT_URI }}"
8
+ EXTRA_ARGS: "--hostname ${{ vars.HOSTNAME }} --env GOOGLE_CLIENT_ID=${{ secrets.GOOGLE_CLIENT_ID }} --env GOOGLE_CLIENT_SECRET=${{ secrets.GOOGLE_CLIENT_SECRET }} --env GOOGLE_REDIRECT_URI=${{ vars.GOOGLE_REDIRECT_URI }}"
9
9
 
10
10
  jobs:
11
11
  publish:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: reflex-google-auth
3
- Version: 0.0.9a16
3
+ Version: 0.1.1
4
4
  Summary: Sign in with Google
5
5
  Author-email: Masen Furer <m_github@0x26.net>
6
6
  License: Apache-2.0
@@ -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) -> dict[str, str]:
83
+ def tokeninfo(self) -> TokenCredential:
65
84
  try:
66
85
  return verify_oauth2_token(
67
86
  json.loads(self.id_token_json)["credential"],
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: reflex-google-auth
3
- Version: 0.0.9a16
3
+ Version: 0.1.1
4
4
  Summary: Sign in with Google
5
5
  Author-email: Masen Furer <m_github@0x26.net>
6
6
  License: Apache-2.0
@@ -10,7 +10,7 @@ class State(GoogleAuthState):
10
10
  @rx.var(cache=True)
11
11
  def protected_content(self) -> str:
12
12
  if self.token_is_valid:
13
- return f"This content can only be viewed by a logged in User. Nice to see you {self.tokeninfo['name']}"
13
+ return f"This content can only be viewed by a logged in User. Nice to see you {self.tokeninfo.get('name')}"
14
14
  return "Not logged in."
15
15
 
16
16