File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
packages/lit-auth-client/src/lib/providers Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -37,13 +37,19 @@ export default class DiscordProvider extends BaseProvider {
3737 /**
3838 * Redirect user to the Lit's Discord login page
3939 *
40+ * @param {Function } [callback] - Optional callback to handle login URL
4041 * @returns {Promise<void> } - Redirects user to Lit login page
4142 */
42- public async signIn ( ) : Promise < void > {
43+ public async signIn ( callback ?: ( url : string ) => void ) : Promise < void > {
4344 // Get login url
4445 const loginUrl = await prepareLoginUrl ( 'discord' , this . redirectUri ) ;
45- // Redirect to login url
46- window . location . assign ( loginUrl ) ;
46+
47+ // If callback is provided, use it. Otherwise, redirect to login url
48+ if ( callback ) {
49+ callback ( loginUrl ) ;
50+ } else {
51+ window . location . assign ( loginUrl ) ;
52+ }
4753 }
4854
4955 /**
You can’t perform that action at this time.
0 commit comments