reflex-google-auth 0.0.8__tar.gz → 0.0.9a2__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.
- reflex_google_auth-0.0.9a2/.github/workflows/publish.yml +43 -0
- reflex_google_auth-0.0.9a2/.gitignore +6 -0
- {reflex_google_auth-0.0.8 → reflex_google_auth-0.0.9a2}/PKG-INFO +2 -2
- {reflex_google_auth-0.0.8 → reflex_google_auth-0.0.9a2}/custom_components/reflex_google_auth.egg-info/PKG-INFO +2 -2
- {reflex_google_auth-0.0.8 → reflex_google_auth-0.0.9a2}/custom_components/reflex_google_auth.egg-info/SOURCES.txt +9 -1
- reflex_google_auth-0.0.9a2/google_auth_demo/.gitignore +5 -0
- reflex_google_auth-0.0.9a2/google_auth_demo/assets/favicon.ico +0 -0
- reflex_google_auth-0.0.9a2/google_auth_demo/google_auth_demo/__init__.py +0 -0
- reflex_google_auth-0.0.9a2/google_auth_demo/google_auth_demo/google_auth_demo.py +84 -0
- reflex_google_auth-0.0.9a2/google_auth_demo/requirements.txt +2 -0
- reflex_google_auth-0.0.9a2/google_auth_demo/rxconfig.py +5 -0
- {reflex_google_auth-0.0.8 → reflex_google_auth-0.0.9a2}/pyproject.toml +5 -2
- {reflex_google_auth-0.0.8 → reflex_google_auth-0.0.9a2}/README.md +0 -0
- {reflex_google_auth-0.0.8 → reflex_google_auth-0.0.9a2}/custom_components/reflex_google_auth/__init__.py +0 -0
- {reflex_google_auth-0.0.8 → reflex_google_auth-0.0.9a2}/custom_components/reflex_google_auth/decorator.py +0 -0
- {reflex_google_auth-0.0.8 → reflex_google_auth-0.0.9a2}/custom_components/reflex_google_auth/google_auth.py +0 -0
- {reflex_google_auth-0.0.8 → reflex_google_auth-0.0.9a2}/custom_components/reflex_google_auth/state.py +0 -0
- {reflex_google_auth-0.0.8 → reflex_google_auth-0.0.9a2}/custom_components/reflex_google_auth.egg-info/dependency_links.txt +0 -0
- {reflex_google_auth-0.0.8 → reflex_google_auth-0.0.9a2}/custom_components/reflex_google_auth.egg-info/requires.txt +0 -0
- {reflex_google_auth-0.0.8 → reflex_google_auth-0.0.9a2}/custom_components/reflex_google_auth.egg-info/top_level.txt +0 -0
- {reflex_google_auth-0.0.8 → reflex_google_auth-0.0.9a2}/setup.cfg +0 -0
@@ -0,0 +1,43 @@
|
|
1
|
+
name: Publish Component to PyPI
|
2
|
+
|
3
|
+
on:
|
4
|
+
push:
|
5
|
+
tags:
|
6
|
+
- "*"
|
7
|
+
|
8
|
+
jobs:
|
9
|
+
publish:
|
10
|
+
name: Publish Component to PyPI
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
steps:
|
13
|
+
- uses: actions/checkout@master
|
14
|
+
- name: Set up Python 3.12
|
15
|
+
uses: actions/setup-python@v3
|
16
|
+
with:
|
17
|
+
python-version: "3.12"
|
18
|
+
- name: Install package
|
19
|
+
run: pip install .
|
20
|
+
- name: Install latest reflex
|
21
|
+
run: pip install 'git+https://github.com/reflex-dev/reflex@masenf/custom-component-publish-dynamic-version'
|
22
|
+
- name: Publish to PyPI
|
23
|
+
run: reflex component publish -t ${{ secrets.PYPI_TOKEN }} --no-share --no-validate-project-info
|
24
|
+
deploy:
|
25
|
+
name: Deploy Demo App to Reflex Cloud
|
26
|
+
runs-on: ubuntu-latest
|
27
|
+
steps:
|
28
|
+
- uses: actions/checkout@master
|
29
|
+
- name: Set up Python 3.12
|
30
|
+
uses: actions/setup-python@v3
|
31
|
+
with:
|
32
|
+
python-version: "3.12"
|
33
|
+
- name: Set tagged version for deploy
|
34
|
+
run: sed -e "s/^reflex-google-auth[ >=].*$/reflex-google-auth==${{ github.event.release.tag_name }}/" -i google_auth_demo/requirements.txt
|
35
|
+
- name: Deploy to ReflexCloud
|
36
|
+
uses: reflex-dev/reflex-deploy-action@v2
|
37
|
+
with:
|
38
|
+
auth_token: ${{ secrets.REFLEX_AUTH_TOKEN }}
|
39
|
+
project_id: ${{ secrets.REFLEX_PROJECT_ID }}
|
40
|
+
app_directory: google_auth_demo
|
41
|
+
extra_args: ${{ env.EXTRA_ARGS }}
|
42
|
+
dry_run: ${{ vars.DRY_RUN }}
|
43
|
+
skip_checkout: "true"
|
@@ -1,5 +1,7 @@
|
|
1
|
+
.gitignore
|
1
2
|
README.md
|
2
3
|
pyproject.toml
|
4
|
+
.github/workflows/publish.yml
|
3
5
|
custom_components/reflex_google_auth/__init__.py
|
4
6
|
custom_components/reflex_google_auth/decorator.py
|
5
7
|
custom_components/reflex_google_auth/google_auth.py
|
@@ -8,4 +10,10 @@ custom_components/reflex_google_auth.egg-info/PKG-INFO
|
|
8
10
|
custom_components/reflex_google_auth.egg-info/SOURCES.txt
|
9
11
|
custom_components/reflex_google_auth.egg-info/dependency_links.txt
|
10
12
|
custom_components/reflex_google_auth.egg-info/requires.txt
|
11
|
-
custom_components/reflex_google_auth.egg-info/top_level.txt
|
13
|
+
custom_components/reflex_google_auth.egg-info/top_level.txt
|
14
|
+
google_auth_demo/.gitignore
|
15
|
+
google_auth_demo/requirements.txt
|
16
|
+
google_auth_demo/rxconfig.py
|
17
|
+
google_auth_demo/assets/favicon.ico
|
18
|
+
google_auth_demo/google_auth_demo/__init__.py
|
19
|
+
google_auth_demo/google_auth_demo/google_auth_demo.py
|
Binary file
|
File without changes
|
@@ -0,0 +1,84 @@
|
|
1
|
+
import reflex as rx
|
2
|
+
|
3
|
+
from reflex_google_auth import (
|
4
|
+
GoogleAuthState,
|
5
|
+
handle_google_login,
|
6
|
+
require_google_login,
|
7
|
+
)
|
8
|
+
|
9
|
+
|
10
|
+
class State(GoogleAuthState):
|
11
|
+
@rx.var(cache=True)
|
12
|
+
def protected_content(self) -> str:
|
13
|
+
if self.token_is_valid:
|
14
|
+
return f"This content can only be viewed by a logged in User. Nice to see you {self.tokeninfo['name']}"
|
15
|
+
return "Not logged in."
|
16
|
+
|
17
|
+
|
18
|
+
def user_info(tokeninfo: rx.vars.ObjectVar) -> rx.Component:
|
19
|
+
return rx.hstack(
|
20
|
+
rx.avatar(
|
21
|
+
src=tokeninfo["picture"],
|
22
|
+
fallback=tokeninfo["name"],
|
23
|
+
size="5",
|
24
|
+
),
|
25
|
+
rx.vstack(
|
26
|
+
rx.heading(tokeninfo["name"], size="6"),
|
27
|
+
rx.text(tokeninfo["email"]),
|
28
|
+
align_items="flex-start",
|
29
|
+
),
|
30
|
+
rx.button("Logout", on_click=GoogleAuthState.logout),
|
31
|
+
padding="10px",
|
32
|
+
)
|
33
|
+
|
34
|
+
|
35
|
+
def index():
|
36
|
+
return rx.vstack(
|
37
|
+
rx.heading("Google OAuth", size="8"),
|
38
|
+
rx.link("Protected Page", href="/protected"),
|
39
|
+
rx.link("Partially Protected Page", href="/partially-protected"),
|
40
|
+
rx.link("Custom Login Button", href="/custom-button"),
|
41
|
+
align="center",
|
42
|
+
)
|
43
|
+
|
44
|
+
|
45
|
+
@rx.page(route="/protected")
|
46
|
+
@require_google_login
|
47
|
+
def protected() -> rx.Component:
|
48
|
+
return rx.vstack(
|
49
|
+
user_info(GoogleAuthState.tokeninfo),
|
50
|
+
rx.text(State.protected_content),
|
51
|
+
rx.link("Home", href="/"),
|
52
|
+
)
|
53
|
+
|
54
|
+
|
55
|
+
@require_google_login
|
56
|
+
def user_name_or_sign_in() -> rx.Component:
|
57
|
+
return rx.heading(GoogleAuthState.tokeninfo["name"], size="6")
|
58
|
+
|
59
|
+
|
60
|
+
@rx.page(route="/partially-protected")
|
61
|
+
def partially_protected() -> rx.Component:
|
62
|
+
return rx.vstack(
|
63
|
+
rx.heading("This page is partially protected."),
|
64
|
+
rx.text(
|
65
|
+
"If you are signed in with google, you should see your name below, otherwise "
|
66
|
+
"you will see a sign in button",
|
67
|
+
),
|
68
|
+
user_name_or_sign_in(),
|
69
|
+
)
|
70
|
+
|
71
|
+
|
72
|
+
@rx.page(route="/custom-button")
|
73
|
+
@require_google_login(
|
74
|
+
button=rx.button("Google Login 🚀", on_click=handle_google_login())
|
75
|
+
)
|
76
|
+
def custom_button() -> rx.Component:
|
77
|
+
return rx.vstack(
|
78
|
+
user_info(GoogleAuthState.tokeninfo),
|
79
|
+
"You clicked a custom button to login, nice",
|
80
|
+
)
|
81
|
+
|
82
|
+
|
83
|
+
app = rx.App()
|
84
|
+
app.add_page(index)
|
@@ -1,13 +1,13 @@
|
|
1
1
|
[build-system]
|
2
2
|
requires = [
|
3
|
-
"setuptools",
|
3
|
+
"setuptools>=64",
|
4
|
+
"setuptools_scm>=8",
|
4
5
|
"wheel",
|
5
6
|
]
|
6
7
|
build-backend = "setuptools.build_meta"
|
7
8
|
|
8
9
|
[project]
|
9
10
|
name = "reflex-google-auth"
|
10
|
-
version = "0.0.8"
|
11
11
|
description = "Sign in with Google"
|
12
12
|
readme = "README.md"
|
13
13
|
license = { text = "Apache-2.0" }
|
@@ -23,6 +23,7 @@ dependencies = [
|
|
23
23
|
classifiers = [
|
24
24
|
"Development Status :: 4 - Beta",
|
25
25
|
]
|
26
|
+
dynamic = ["version"]
|
26
27
|
|
27
28
|
[project.urls]
|
28
29
|
homepage = "https://github.com/masenf/reflex-google-auth"
|
@@ -32,3 +33,5 @@ dev = ["build", "twine"]
|
|
32
33
|
|
33
34
|
[tool.setuptools.packages.find]
|
34
35
|
where = ["custom_components"]
|
36
|
+
|
37
|
+
[tool.setuptools_scm]
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|