> ## Documentation Index
> Fetch the complete documentation index at: https://stytch.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Start SSO Flow

> Start a Single Sign-On authentication flow using the Stytch Next.js SDK

`sso.start()` starts an SSO flow by redirecting the browser to Stytch's [SSO Start](https://stytch.com/docs/api-reference/b2b/api/sso/shared/start-sso-authenticate.md) endpoint. The method will also generate a PKCE `code_verifier` and store it in localstorage on the device.

### Parameters

**connection\_id** `string` *required*

Globally unique UUID that identifies a specific SSO `connection_id` for a Member.

**login\_redirect\_url** `string`

The URL Stytch redirects to after the SSO flow is completed for a Member that already exists. This URL should be a route in your application which will run [`sso.authenticate`](./authenticate) and finish the login.

The URL must be configured as a Login URL in the [Stytch Dashboard](https://stytch.com/dashboard/redirect-urls). If the field is not specified, the default Login URL will be used.

**signup\_redirect\_url** `string`

The URL Stytch redirects to after the SSO flow is completed for a Member that does not yet exist. This URL should be a route in your application which will run sso.authenticate (see below) and finish the signup.

The URL must be configured as a Signup URL in the [Stytch Dashboard](https://stytch.com/dashboard/redirect-urls). If the field is not specified, the default Signup URL will be used.

**providerParams** `object`

> [!NOTE]
>
> This parameter currently applies to **OIDC flows only**. Custom parameters passed into SAML SSO flows will be ignored.

An object with any additional parameters that you'd like to pass along to the Identity Provider in the OIDC SSO flow.

For example, some Identity Providers support a `login_hint` parameter that allows you to pre-populate the SSO login flow with a suggested email address. To specify the `login_hint` parameter in your SSO request, set the `providerParams` value to `{ 'login_hint': 'example@email.com' }`.

We recommend consulting each Identity Provider's documentation for a list of supported parameters.

```jsx theme={null}
import { useStytchB2BClient } from '@stytch/nextjs/b2b';

export const SSOLogin = () => {
  const stytch = useStytchB2BClient();

  const startSSO = () => {
    stytch.sso.start({
      connection_id: 'saml-connection-test-d89ff7a0-e86f-4b4d-b6a3-9a74d967528e',
      login_redirect_url: 'https://example.com/authenticate',
      signup_redirect_url: 'https://example.com/authenticate',
    });
  };

  return <button onClick={startSSO}>Sign in with SSO</button>;
};
```
