fix: native gitlab & github login

This commit is contained in:
2024-11-17 21:15:25 +07:00
parent 83d0ed380d
commit 95f9f76edd
10 changed files with 92 additions and 112 deletions
@@ -1,9 +1,9 @@
import React, { useEffect, useMemo } from "react";
import { makeRedirectUri, useAuthRequest } from "expo-auth-session";
import appConfig from "@/app.json";
import { Button } from "tamagui";
import { useOAuthCallback } from "../hooks";
import { useServerConfig } from "@/hooks/useServerConfig";
import { scheme } from "@/app.json";
const LoginGithubButton = () => {
const { data: clientId } = useServerConfig("github_client_id");
@@ -20,7 +20,7 @@ const LoginGithubButton = () => {
{
clientId: clientId,
scopes: ["identity"],
redirectUri: makeRedirectUri({ scheme: appConfig.scheme }),
redirectUri: makeRedirectUri({ scheme, path: "auth/login" }),
},
discovery
);
@@ -28,7 +28,7 @@ const LoginGithubButton = () => {
useEffect(() => {
if (response?.type === "success") {
const { code } = response.params;
oauth.mutate(code);
oauth.mutate({ code });
}
}, [response]);
@@ -1,8 +1,9 @@
import React, { useEffect, useMemo } from "react";
import { useAuthRequest } from "expo-auth-session";
import { makeRedirectUri, useAuthRequest } from "expo-auth-session";
import { Button } from "tamagui";
import { useOAuthCallback } from "../hooks";
import { useServerConfig } from "@/hooks/useServerConfig";
import { scheme } from "@/app.json";
const LoginGitlabButton = () => {
const { data: clientId } = useServerConfig("gitlab_client_id");
@@ -19,8 +20,7 @@ const LoginGitlabButton = () => {
{
clientId,
scopes: ["read_user"],
// redirectUri: makeRedirectUri({ scheme: appConfig.scheme }),
redirectUri: "http://localhost:8081",
redirectUri: makeRedirectUri({ scheme, path: "auth/login" }),
},
discovery
);