fork
Configure Feed
Select the types of activity you want to include in your feed.
Live video on the AT Protocol
fork
Configure Feed
Select the types of activity you want to include in your feed.
1import type { OAuthAuthorizationServerMetadata } from "@atproto/oauth-client";
2import {
3 OAuthResolver,
4 ResolveOAuthOptions,
5} from "@atproto/oauth-client/dist/oauth-resolver";
6
7export class StreamplaceOAuthResolver extends OAuthResolver {
8 private currentResourceServer: string | null = null;
9
10 constructor(
11 private streamplaceUrl: string,
12 ...args: ConstructorParameters<typeof OAuthResolver>
13 ) {
14 super(...args);
15 }
16
17 async resolveFromService(
18 input: string,
19 options?: ResolveOAuthOptions,
20 ): Promise<{
21 metadata: OAuthAuthorizationServerMetadata;
22 }> {
23 // Input is the resource server URL (e.g., https://selfhosted.social)
24 // Store it for use in login_hint
25 this.currentResourceServer = input;
26
27 // Always fetch metadata from our backend
28 // The issuer will be our backend, not the resource server
29 const metadata = await this.getResourceServerMetadata(
30 this.streamplaceUrl,
31 options,
32 );
33
34 return { metadata };
35 }
36
37 getCurrentResourceServer(): string | null {
38 return this.currentResourceServer;
39 }
40}