Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9611749

Browse files
committed
feat(types): add connection, screen_hint, login_hint to AuthorizationParameters
1 parent 8eb6cd2 commit 9611749

2 files changed

Lines changed: 101 additions & 0 deletions

File tree

EXAMPLES.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
# Examples
22

33
- [Passing authorization parameters](#passing-authorization-parameters)
4+
- [Social Login](#social-login)
5+
- [Passwordless (via Universal Login)](#passwordless-via-universal-login)
6+
- [Showing the signup screen](#showing-the-signup-screen)
7+
- [Pre-filling the login field](#pre-filling-the-login-field)
48
- [The `returnTo` parameter](#the-returnto-parameter)
59
- [Redirecting the user after authentication](#redirecting-the-user-after-authentication)
610
- [Redirecting the user after logging out](#redirecting-the-user-after-logging-out)
@@ -177,6 +181,82 @@ The second option is through the query parameters to the `/auth/login` endpoint
177181
<a href="/auth/login?audience=urn:my-api">Login</a>
178182
```
179183

184+
### Social Login
185+
186+
To skip the Universal Login page and send users directly to a social provider, pass the `connection` parameter with the Auth0 connection name:
187+
188+
```html
189+
<a href="/auth/login?connection=google-oauth2">Continue with Google</a>
190+
<a href="/auth/login?connection=github">Continue with GitHub</a>
191+
<a href="/auth/login?connection=facebook">Continue with Facebook</a>
192+
```
193+
194+
Or configure it statically for all logins:
195+
196+
```ts
197+
export const auth0 = new Auth0Client({
198+
authorizationParameters: {
199+
connection: "google-oauth2"
200+
}
201+
});
202+
```
203+
204+
### Passwordless (via Universal Login)
205+
206+
Auth0 supports passwordless login using email magic links/OTP or SMS OTP through the Universal Login page. The SDK forwards the `connection` parameter to Auth0, which handles the entire passwordless flow and redirects back to your app with a standard authorization code.
207+
208+
Prerequisites:
209+
210+
- Enable the **Email** or **SMS** passwordless connection in the [Auth0 Dashboard](https://manage.auth0.com) under **Authentication > Passwordless**.
211+
- Add the connection to your application.
212+
213+
**Email passwordless:**
214+
215+
```html
216+
<!-- Auth0 will send a magic link or OTP to the user's email -->
217+
<a href="/auth/login?connection=email">Login with Email</a>
218+
```
219+
220+
**SMS passwordless:**
221+
222+
```html
223+
<!-- Auth0 will send an OTP to the user's phone number -->
224+
<a href="/auth/login?connection=sms">Login with SMS</a>
225+
```
226+
227+
The user experience on the Auth0-hosted page (magic link vs. OTP code) is configured in the Auth0 Dashboard under the connection settings. Your application code does not change — the callback and session creation work identically to any other login.
228+
229+
### Showing the signup screen
230+
231+
To send users directly to the registration form instead of the login form:
232+
233+
```html
234+
<a href="/auth/login?screen_hint=signup">Create account</a>
235+
```
236+
237+
Or statically:
238+
239+
```ts
240+
export const auth0 = new Auth0Client({
241+
authorizationParameters: {
242+
screen_hint: "signup"
243+
}
244+
});
245+
```
246+
247+
### Pre-filling the login field
248+
249+
To pre-fill the email or phone number field on the Universal Login page:
250+
251+
```ts
252+
// In a Server Action or Route Handler
253+
const response = await auth0.startInteractiveLogin({
254+
authorizationParameters: {
255+
login_hint: "[email protected]"
256+
}
257+
});
258+
```
259+
180260
## The `returnTo` parameter
181261

182262
### Redirecting the user after authentication

src/types/authorize.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,27 @@ export interface AuthorizationParameters {
3333
* The organization ID will be included in the user's session after successful authentication.
3434
*/
3535
organization?: string;
36+
/**
37+
* The name of the Auth0 connection to use for authentication.
38+
*
39+
* Use this to skip the Universal Login page and go directly to a specific
40+
* identity provider or authentication method (e.g. `'google-oauth2'`, `'github'`, `'email'`, `'sms'`).
41+
*/
42+
connection?: string;
43+
/**
44+
* Hint to the Auth0 Universal Login page which screen to show.
45+
*
46+
* - `'login'` — show the login screen (default)
47+
* - `'signup'` — show the sign-up / registration screen
48+
*/
49+
screen_hint?: 'login' | 'signup';
50+
/**
51+
* Pre-fills the email or phone field on the Universal Login page.
52+
*
53+
* Pass the user's known identifier (email address or phone number) to
54+
* improve UX by skipping manual entry.
55+
*/
56+
login_hint?: string;
3657
/**
3758
* Additional authorization parameters.
3859
*/

0 commit comments

Comments
 (0)