mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-04-08 03:48:14 +02:00
Fix Google Drive Connector when using OAuth
This commit is contained in:
parent
38d516cc7a
commit
ae0dbfadc6
@ -400,7 +400,7 @@ export const DriveOAuthSection = ({
|
||||
<Button
|
||||
onClick={async () => {
|
||||
const [authUrl, errorMsg] = await setupGoogleDriveOAuth({
|
||||
isPublic: true,
|
||||
isAdmin: true,
|
||||
});
|
||||
if (authUrl) {
|
||||
// cookie used by callback to determine where to finally redirect to
|
||||
|
@ -114,7 +114,7 @@ export const GoogleDriveCard = ({
|
||||
<Button
|
||||
onClick={async () => {
|
||||
const [authUrl, errorMsg] = await setupGoogleDriveOAuth({
|
||||
isPublic: false,
|
||||
isAdmin: false,
|
||||
});
|
||||
if (authUrl) {
|
||||
// cookie used by callback to determine where to finally redirect to
|
||||
|
@ -1,19 +1,17 @@
|
||||
import { Credential } from "@/lib/types";
|
||||
|
||||
interface SetupGoogleDriveArgs {
|
||||
isPublic: boolean;
|
||||
}
|
||||
|
||||
export const setupGoogleDriveOAuth = async ({
|
||||
isPublic,
|
||||
}: SetupGoogleDriveArgs): Promise<[string | null, string]> => {
|
||||
isAdmin,
|
||||
}: {
|
||||
isAdmin: boolean;
|
||||
}): Promise<[string | null, string]> => {
|
||||
const credentialCreationResponse = await fetch("/api/manage/credential", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
public_doc: isPublic,
|
||||
is_admin: isAdmin,
|
||||
credential_json: {},
|
||||
}),
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user