@@ -3,9 +3,10 @@ import {
33 Prompt ,
44 StandardLogtoClient ,
55 createRequester ,
6+ type SignInOptions ,
67 type InteractionMode ,
78 type LogtoConfig ,
8- } from '@logto/client/shim ' ;
9+ } from '@logto/client' ;
910import { decodeIdToken } from '@logto/js' ;
1011import * as WebBrowser from 'expo-web-browser' ;
1112import { Platform } from 'react-native' ;
@@ -66,7 +67,6 @@ export class LogtoClient extends StandardLogtoClient {
6667 case 'sign-out' : {
6768 break ;
6869 }
69- // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check -- just in case
7070 default : {
7171 throw new LogtoNativeClientError ( 'navigation_purpose_not_supported' ) ;
7272 }
@@ -103,6 +103,19 @@ export class LogtoClient extends StandardLogtoClient {
103103 this . storage = storage ;
104104 }
105105
106+ /**
107+ * Start the sign-in flow with the specified redirect URI. The URI must be registered in the
108+ * Logto Console. It uses `WebBrowser.openAuthSessionAsync` to open the browser and start the
109+ * sign-in flow.
110+ *
111+ * The user will be redirected to that URI after the sign-in flow is completed, and the client
112+ * will handle the callback to exchange the authorization code for the tokens.
113+ *
114+ * @param options The options for the sign-in flow.
115+ *
116+ * @see {@link SignInOptions }
117+ */
118+ override async signIn ( options : SignInOptions ) : Promise < void > ;
106119 /**
107120 * Start the sign-in flow with the specified redirect URI. The URI must be registered in the
108121 * Logto Console. It uses `WebBrowser.openAuthSessionAsync` to open the browser and start the
@@ -117,8 +130,14 @@ export class LogtoClient extends StandardLogtoClient {
117130 *
118131 * @see {@link InteractionMode }
119132 */
120- override async signIn ( redirectUri : string , interactionMode ?: InteractionMode ) : Promise < void > {
121- await super . signIn ( redirectUri , interactionMode ) ;
133+ override async signIn ( redirectUri : string , interactionMode ?: InteractionMode ) : Promise < void > ;
134+ override async signIn (
135+ options : SignInOptions | string ,
136+ interactionMode ?: InteractionMode
137+ ) : Promise < void > {
138+ await ( typeof options === 'string'
139+ ? super . signIn ( options , interactionMode )
140+ : super . signIn ( options ) ) ;
122141
123142 if ( this . authSessionResult ?. type !== 'success' ) {
124143 throw new LogtoNativeClientError ( 'auth_session_failed' ) ;
0 commit comments