-
-
Notifications
You must be signed in to change notification settings - Fork 440
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support
login_hint
params for sign-in url
- Loading branch information
Showing
7 changed files
with
56 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
--- | ||
"@logto/experience": minor | ||
"@logto/schemas": minor | ||
"@logto/core": minor | ||
--- | ||
|
||
add support for `login_hint` parameter in sign-in method | ||
|
||
This feature allows you to provide a suggested identifier (email, phone, or username) for the user, improving the sign-in experience especially in scenarios where the user's identifier is known or can be inferred. | ||
|
||
Example: | ||
|
||
```javascript | ||
// Example usage (React project using React SDK) | ||
void signIn({ | ||
redirectUri, | ||
loginHint: '[email protected]', | ||
firstScreen: 'signIn', // or 'register' | ||
}); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -147,6 +147,10 @@ describe('buildLoginPromptUrl', () => { | |
expect(buildLoginPromptUrl({ first_screen: FirstScreen.SignIn }, demoAppApplicationId)).toBe( | ||
'sign-in?app_id=demo-app' | ||
); | ||
expect( | ||
buildLoginPromptUrl({ first_screen: FirstScreen.SignIn, login_hint: '[email protected]' }) | ||
).toBe('sign-in?login_hint=user%40mail.com'); | ||
|
||
// Legacy interactionMode support | ||
expect(buildLoginPromptUrl({ interaction_mode: InteractionMode.SignUp })).toBe('register'); | ||
}); | ||
|
@@ -169,7 +173,10 @@ describe('buildLoginPromptUrl', () => { | |
|
||
it('should return the correct url for mixed parameters', () => { | ||
expect( | ||
buildLoginPromptUrl({ first_screen: FirstScreen.Register, direct_sign_in: 'method:target' }) | ||
buildLoginPromptUrl({ | ||
first_screen: FirstScreen.Register, | ||
direct_sign_in: 'method:target', | ||
}) | ||
).toBe('direct/method/target?fallback=register'); | ||
expect( | ||
buildLoginPromptUrl( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters