Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions streamlit_supabase_auth/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ def login_form(
url: Optional[str] = None,
apiKey: Optional[str] = None,
providers: Optional[List[str]] = None,
redirectTo: Optional[str] = None,
onlyThirdPartyProviders: Optional[bool] = None,
) -> Mapping[str, Any]:
"""Creates a new instance of `login` component using supabase-js.

Expand All @@ -67,6 +69,8 @@ def login_form(
apiKey=apiKey or os.environ["SUPABASE_KEY"],
providers=providers or [],
key="login",
redirectTo=redirectTo or None,
onlyThirdPartyProviders=onlyThirdPartyProviders or False,
)
# Modify the value returned so that it can be used as default selections.
return session
Expand Down
16 changes: 10 additions & 6 deletions streamlit_supabase_auth/frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 15 additions & 3 deletions streamlit_supabase_auth/frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,11 @@ const Container = (props: {
type: "login" | "logout";
supabase: SupabaseClient;
providers: Provider[];
redirectTo?: string;
onlyThirdPartyProviders?: boolean;
}) => {
const { type, supabase, providers } = props;
const { type, supabase, providers, redirectTo, onlyThirdPartyProviders } =
props;

// Update iframe height when user context changes
useEffect(() => Streamlit.setFrameHeight());
Expand All @@ -112,6 +115,8 @@ const Container = (props: {
providers={providers}
supabaseClient={supabase}
onError={() => Streamlit.setFrameHeight()}
redirectTo={redirectTo}
onlyThirdPartyProviders={onlyThirdPartyProviders}
/>
);
}
Expand All @@ -128,7 +133,8 @@ const Container = (props: {
};

const App = (props: ComponentProps) => {
const { url, apiKey, providers, key } = props.args;
const { url, apiKey, providers, key, redirectTo, onlyThirdPartyProviders } =
props.args;

// Initialise supabase client once
const [supabase, setSupabase] = useState<SupabaseClient>(() =>
Expand All @@ -154,7 +160,13 @@ const App = (props: ComponentProps) => {

return (
<Auth.UserContextProvider supabaseClient={supabase}>
<Container type={key} supabase={supabase} providers={providers} />
<Container
type={key}
supabase={supabase}
providers={providers}
redirectTo={redirectTo}
onlyThirdPartyProviders={onlyThirdPartyProviders}
/>
</Auth.UserContextProvider>
);
};
Expand Down
2 changes: 2 additions & 0 deletions streamlit_supabase_auth/frontend/src/Auth/Auth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ function SocialAuth({
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const [error, setError] = useState("");

console.log({ redirectTo });

const handleProviderSignIn = async (provider: Provider) => {
setLoading(true);
try {
Expand Down