Skip to content

Commit

Permalink
small linear connector improvements (#3929)
Browse files Browse the repository at this point in the history
* small linear connector improvements

* add todo for url handling
  • Loading branch information
evan-danswer authored Feb 7, 2025
1 parent 48ac690 commit 9b0cba3
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
1 change: 1 addition & 0 deletions backend/onyx/connectors/linear/connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ def oauth_authorization_url(
f"&response_type=code"
f"&scope=read"
f"&state={state}"
f"&prompt=consent" # prompts user for access; allows choosing workspace
)

@classmethod
Expand Down
8 changes: 3 additions & 5 deletions backend/onyx/server/documents/standard_oauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,10 @@ def oauth_callback(
db_session=db_session,
)

# TODO: use a library for url handling
sep = "&" if "?" in desired_return_url else "?"
return CallbackResponse(
redirect_url=(
f"{desired_return_url}?credentialId={credential.id}"
if "?" not in desired_return_url
else f"{desired_return_url}&credentialId={credential.id}"
)
redirect_url=f"{desired_return_url}{sep}credentialId={credential.id}"
)


Expand Down
8 changes: 6 additions & 2 deletions web/src/app/admin/connectors/[connector]/AddConnectorPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ import AdvancedFormPage from "./pages/Advanced";
import DynamicConnectionForm from "./pages/DynamicConnectorCreationForm";
import CreateCredential from "@/components/credentials/actions/CreateCredential";
import ModifyCredential from "@/components/credentials/actions/ModifyCredential";
import { ConfigurableSources, oauthSupportedSources } from "@/lib/types";
import {
ConfigurableSources,
oauthSupportedSources,
ValidSources,
} from "@/lib/types";
import {
Credential,
credentialTemplates,
Expand Down Expand Up @@ -444,7 +448,7 @@ export default function AddConnector({
<CardSection>
<Title className="mb-2 text-lg">Select a credential</Title>

{connector == "gmail" ? (
{connector == ValidSources.Gmail ? (
<GmailMain />
) : (
<>
Expand Down
2 changes: 1 addition & 1 deletion web/src/lib/connectors/connectors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ For example, specifying .*-support.* as a "channel" will cause the connector to
advanced_values: [],
},
linear: {
description: "Configure Dropbox connector",
description: "Configure Linear connector",
values: [],
advanced_values: [],
},
Expand Down
6 changes: 3 additions & 3 deletions web/src/lib/connectors/credentials.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export interface LoopioCredentialJson {
}

export interface LinearCredentialJson {
linear_api_key: string;
linear_access_token: string;
}

export interface HubSpotCredentialJson {
Expand Down Expand Up @@ -250,7 +250,7 @@ export const credentialTemplates: Record<ValidSources, any> = {
gong_access_key_secret: "",
} as GongCredentialJson,
zulip: { zuliprc_content: "" } as ZulipCredentialJson,
linear: { linear_api_key: "" } as LinearCredentialJson,
linear: { linear_access_token: "" } as LinearCredentialJson,
hubspot: { hubspot_access_token: "" } as HubSpotCredentialJson,
document360: {
portal_id: "",
Expand Down Expand Up @@ -404,7 +404,7 @@ export const credentialDisplayNames: Record<string, string> = {
loopio_client_token: "Loopio Client Token",

// Linear
linear_api_key: "Linear API Key",
linear_access_token: "Linear Access Token",

// HubSpot
hubspot_access_token: "HubSpot Access Token",
Expand Down

0 comments on commit 9b0cba3

Please sign in to comment.