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