Optional
connectionThe name of an OAuth2/social connection. Use it to directly show that identity provider's login page, skipping the Universal Login page itself. By default no connection is specified, so the Universal Login page will be displayed.
import { handleAuth, handleLogin } from '@auth0/nextjs-auth0';
export default handleAuth({
login: async (req, res) => {
try {
await handleLogin(req, res, {
// Get the connection name from the Auth0 Dashboard
authorizationParams: { connection: 'github' }
});
} catch (error) {
console.error(error);
}
}
});
Optional
connection_Provider scopes for OAuth2/social connections, such as GitHub or Google.
import { handleAuth, handleLogin } from '@auth0/nextjs-auth0';
export default handleAuth({
login: async (req, res) => {
try {
await handleLogin(req, res, {
authorizationParams: {
connection: 'github',
connection_scope: 'public_repo read:user'
}
});
} catch (error) {
console.error(error);
}
}
});
Optional
invitationThe invitation id to join an organization.
To create a link for your user's to accept an organization invite, read the invitation
and organization
query params and pass them to the authorization server to log the user in:
// pages/api/invite.js
import { handleLogin } from '@auth0/nextjs-auth0';
export default async function invite(req, res) {
try {
const { invitation, organization } = req.query;
if (!invitation) {
res.status(400).end('Missing "invitation" parameter');
}
await handleLogin(req, res, {
authorizationParams: {
invitation,
organization
}
});
} catch (error) {
res.status(error.status || 500).end();
}
} ;
Your invite url can then take the format:
https://example.com/api/invite?invitation=invitation_id&organization=org_id_or_name
.
Optional
organizationThis is useful to specify instead of NextConfig.organization when your app has multiple organizations. It should match CallbackOptions.organization.
Optional
screen_Provides a hint to Auth0 as to what flow should be displayed. The default behavior is to show a login page but you can override this by passing 'signup' to show the signup page instead.
This only affects the New Universal Login Experience.
Authorization params to pass to the login handler.