Skip to content

Commit 81a8c15

Browse files
committed
wip
1 parent 5b54994 commit 81a8c15

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

examples/chat-ui/src/App.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ function App() {
66
return (
77
<Router>
88
<Routes>
9+
<Route path="/oauth/groq/callback" element={<OAuthCallback provider="groq" />} />
910
<Route path="/oauth/openrouter/callback" element={<OAuthCallback provider="openrouter" />} />
1011
<Route path="/oauth/callback" element={<OAuthCallback provider="openrouter" />} />
1112
<Route path="/" element={<ChatApp />} />

examples/chat-ui/src/types/models.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,12 @@ export const providers: Record<SupportedProvider, Provider> = {
6767
baseUrl: 'https://api.groq.com/openai/v1',
6868
logo: '🚀',
6969
documentationUrl: 'https://console.groq.com/docs',
70-
authType: 'apiKey',
7170
apiKeyHeader: 'Authorization',
72-
// oauth: {
73-
// authorizeUrl: 'http://localhost:3000/keys/request',
74-
// tokenUrl: 'https://openrouter.ai/api/v1/auth/keys'
75-
// },
71+
authType: 'oauth',
72+
oauth: {
73+
authorizeUrl: 'http://localhost:3000/keys/request',
74+
tokenUrl: 'http://localhost:3000/keys/request/exchange',
75+
},
7676
},
7777
anthropic: {
7878
id: 'anthropic',

examples/chat-ui/src/utils/auth.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ export async function completeOAuthFlow(providerId: SupportedProvider, code: str
152152
// Retrieve PKCE state
153153
let pkceState: PKCEState
154154

155-
if (state === 'no-state' && providerId === 'openrouter') {
155+
if (state === 'no-state' && (providerId === 'openrouter' || providerId === 'groq')) {
156156
// OpenRouter doesn't use state, find the most recent PKCE state for this provider
157157
const allKeys = Object.keys(sessionStorage)
158158
const pkceKeys = allKeys.filter((key) => key.startsWith(`pkce_${providerId}_`))
@@ -222,6 +222,7 @@ export async function completeOAuthFlow(providerId: SupportedProvider, code: str
222222
const requestBody = new URLSearchParams({
223223
grant_type: 'authorization_code',
224224
code,
225+
// TODO: state??
225226
redirect_uri: getRedirectUri(providerId),
226227
code_verifier: pkceState.code_verifier,
227228
})

0 commit comments

Comments
 (0)