mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-07-03 20:41:07 +02:00
wire up to local supabase oidc oauth
This commit is contained in:
parent
0be3e60560
commit
bd6ef0df28
3 changed files with 36 additions and 4 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
import * as React from "react"
|
import * as React from "react"
|
||||||
import { useState, useEffect, useCallback } from "react"
|
import { useState, useEffect, useCallback } from "react"
|
||||||
import { AlertTriangle, Loader2, Mic, Mail, MessageSquare } from "lucide-react"
|
import { AlertTriangle, Loader2, Mic, Mail, MessageSquare, User } from "lucide-react"
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Popover,
|
Popover,
|
||||||
|
|
@ -505,6 +505,17 @@ export function ConnectorsPopover({ children, tooltip, open: openProp, onOpenCha
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
|
{/* Rowboat Account */}
|
||||||
|
{providers.includes('rowboat') && (
|
||||||
|
<>
|
||||||
|
<div className="px-2 py-1.5">
|
||||||
|
<span className="text-xs font-medium text-muted-foreground">Account</span>
|
||||||
|
</div>
|
||||||
|
{renderOAuthProvider('rowboat', 'Rowboat', <User className="size-4" />, 'Connect your Rowboat account')}
|
||||||
|
<Separator className="my-2" />
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
|
||||||
{/* Email & Calendar Section - Google */}
|
{/* Email & Calendar Section - Google */}
|
||||||
{providers.includes('google') && (
|
{providers.includes('google') && (
|
||||||
<>
|
<>
|
||||||
|
|
|
||||||
|
|
@ -46,13 +46,15 @@ export async function discoverConfiguration(
|
||||||
console.log(`[OAuth] Using cached configuration for ${issuerUrl}`);
|
console.log(`[OAuth] Using cached configuration for ${issuerUrl}`);
|
||||||
return cached;
|
return cached;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`[OAuth] Discovering authorization server metadata for ${issuerUrl}...`);
|
console.log(`[OAuth] Discovering authorization server metadata for ${issuerUrl}...`);
|
||||||
const config = await client.discovery(
|
const config = await client.discovery(
|
||||||
new URL(issuerUrl),
|
new URL(issuerUrl),
|
||||||
clientId,
|
clientId,
|
||||||
undefined, // no client_secret (PKCE flow)
|
undefined, // no client_secret (PKCE flow)
|
||||||
client.None() // PKCE doesn't require client authentication
|
client.None(), // PKCE doesn't require client authentication
|
||||||
|
{
|
||||||
|
execute: [client.allowInsecureRequests],
|
||||||
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
configCache.set(cacheKey, config);
|
configCache.set(cacheKey, config);
|
||||||
|
|
@ -110,7 +112,10 @@ export async function registerClient(
|
||||||
client_name: clientName,
|
client_name: clientName,
|
||||||
scope: scopes.join(' '),
|
scope: scopes.join(' '),
|
||||||
},
|
},
|
||||||
client.None()
|
client.None(),
|
||||||
|
{
|
||||||
|
execute: [client.allowInsecureRequests],
|
||||||
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
const metadata = config.clientMetadata();
|
const metadata = config.clientMetadata();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,7 @@
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
|
||||||
|
const SUPABASE_PROJECT_URL = 'http://127.0.0.1:54321';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Discovery configuration - how to get OAuth endpoints
|
* Discovery configuration - how to get OAuth endpoints
|
||||||
*/
|
*/
|
||||||
|
|
@ -51,6 +53,20 @@ export type ProviderConfigEntry = ProviderConfig[string];
|
||||||
* All configured OAuth providers
|
* All configured OAuth providers
|
||||||
*/
|
*/
|
||||||
const providerConfigs: ProviderConfig = {
|
const providerConfigs: ProviderConfig = {
|
||||||
|
rowboat: {
|
||||||
|
discovery: {
|
||||||
|
mode: 'issuer',
|
||||||
|
issuer: `${SUPABASE_PROJECT_URL}/.well-known/oauth-authorization-server`,
|
||||||
|
},
|
||||||
|
client: {
|
||||||
|
mode: 'dcr',
|
||||||
|
},
|
||||||
|
scopes: [
|
||||||
|
"openid",
|
||||||
|
"email",
|
||||||
|
"profile",
|
||||||
|
],
|
||||||
|
},
|
||||||
google: {
|
google: {
|
||||||
discovery: {
|
discovery: {
|
||||||
mode: 'issuer',
|
mode: 'issuer',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue