@ley0x/better-auth-lastfm
Version:
Last.fm authentication plugin for BetterAuth
57 lines (52 loc) • 1.58 kB
text/typescript
import * as better_auth_client from 'better-auth/client';
import { BetterAuthPlugin } from 'better-auth';
interface LastfmPluginOptions {
/**
* Last.fm API key
*/
apiKey: string;
/**
* Last.fm shared secret for API signature generation
*/
sharedSecret: string;
/**
* Base URL for your application (used for callback URL generation)
* @default process.env.BETTER_AUTH_URL || 'http://localhost:3000'
*/
baseUrl?: string;
/**
* Custom redirect path after successful authentication
* @default '/dashboard'
*/
redirectTo?: string;
}
/**
* Last.fm authentication plugin for BetterAuth
*
* Provides Last.fm authentication using their custom API flow (not OAuth)
* Creates a session with the Last.fm session key for subsequent API calls
*/
declare function lastfmPlugin(options: LastfmPluginOptions): BetterAuthPlugin;
/**
* Client-side plugin for Last.fm authentication
* Provides methods to interact with Last.fm authentication flow
*/
declare const lastfmClientPlugin: () => {
id: "lastfm";
$InferServerPlugin: ReturnType<typeof lastfmPlugin>;
getActions: ($fetch: better_auth_client.BetterFetch) => {
signInWithLastfm: () => Promise<void>;
getLastfmSession: () => Promise<{
data: unknown;
error: null;
} | {
data: null;
error: {
message?: string | undefined;
status: number;
statusText: string;
};
}>;
};
};
export { lastfmClientPlugin };