Actions109
- Activity Actions
- Assets Actions
- Authentication Actions
- Collections Actions
- Extensions Actions
- Fields Actions
- Files Actions
- Folders Actions
- Items Actions
- Permissions Actions
- Presets Actions
- Relations Actions
- Revisions Actions
- Roles Actions
- Settings Actions
- Users Actions
- Utilities Actions
- Webhooks Actions
Authentication → Start OAuth Flow
AI-generatedOverview
The "Start OAuth Flow" operation under the Authentication resource in this custom n8n node is designed to initiate an OAuth authentication process with a specified provider using the Directus API. This operation is useful when you want to start the OAuth login flow for a user, typically as part of integrating third-party authentication (e.g., Google, GitHub) into your workflow.
Common scenarios:
- Initiating user authentication via external OAuth providers.
- Automating the process of obtaining authorization URLs for user redirection.
- Integrating Directus-managed authentication flows into broader automation pipelines.
Practical example:
You might use this node to trigger the OAuth login process for a user, retrieve the necessary URL, and then redirect the user to authenticate with a third-party service.
Properties
| Name | Type | Meaning |
|---|---|---|
| Provider | String | Key of the activated OAuth provider. Specifies which OAuth provider to use for the authentication flow. |
| Additional Fields | Object | Optional collection of extra parameters. |
| └ Redirect | String | (Optional) Where to redirect on successful login. If set, authentication details are set in cookies; otherwise, a JSON response is returned. |
Output
- The output will be a
jsonobject containing the response from the Directus API after initiating the OAuth flow. - The structure of the output depends on the Directus API's response for starting an OAuth flow, but typically includes information such as the URL to which the user should be redirected to continue the OAuth process.
Example output:
{
"json": {
// Response data from Directus, e.g.,
"data": {
"url": "https://oauth.provider.com/authorize?..."
}
}
}
- If the request fails and "Continue On Fail" is enabled, the output will contain an error message:
{
"json": {
"error": "Error message"
}
}
Dependencies
- Directus API: Requires access to a running Directus instance with OAuth providers configured.
- API Credentials: The node requires valid Directus API credentials (
directusApi) to make requests. - OAuth Providers: At least one OAuth provider must be activated and configured in Directus.
- (Optional) Environment Variables: Depending on your Directus setup, environment variables may be needed for OAuth provider configuration.
Troubleshooting
Common issues:
- Invalid Provider Key: If the specified provider key does not match any activated OAuth provider, the API will return an error.
- Missing Redirect Parameter: If the redirect parameter is required by your OAuth provider or Directus setup and is not provided, authentication may fail or behave unexpectedly.
- Misconfigured OAuth Provider: Ensure that the OAuth provider is correctly set up in Directus, including client ID, secret, and callback URLs.
Common error messages:
"Provider not found": Check that the provider key matches an activated provider in Directus."Invalid redirect URI": Ensure the redirect URI is correctly set and registered with the OAuth provider."Authentication failed": Review the provider configuration and ensure all required fields are present.