π¨ The ultimate agentic social media scheduling tool π€
TypeScript nextjsopen-sourceopen-source-social-media-scheduling-toolosspostiz-cloudpostiz-hostedredisscheduling-toolsocial-media-scheduling-tooltypescript
import {
AuthProvider,
AuthProviderAbstract,
} from '@gitroom/backend/services/auth/providers.interface';
import { NeynarAPIClient } from '@neynar/nodejs-sdk';
const client = new NeynarAPIClient({
apiKey: process.env.NEYNAR_SECRET_KEY || '00000000-000-0000-000-000000000000',
});
@AuthProvider({ provider: 'FARCASTER' })
export class FarcasterProvider extends AuthProviderAbstract {
// no OAuth redirect here, the frontend only needs the state nonce that
// pairs with the oauth_state cookie set by /auth/oauth/FARCASTER
generateLink(query?: { state?: string }) {
return query?.state || '';
}
async getToken(code: string, _redirectUri?: string) {
const data = JSON.parse(Buffer.from(code, 'base64').toString());
const status = await client.lookupSigner({ signerUuid: data.signer_uuid });
if (status.status === 'approved') {
return data.signer_uuid;
}
return '';
}
async getUser(providerToken: string) {
const status = await client.lookupSigner({ signerUuid: providerToken });
if (status.status !== 'approved') {
return {
id: '',
email: '',
};
}
return {
id: String('farcaster_' + status.fid),
email: String('farcaster_' + status.fid),
};
}
}