Skip to content

Commit 0edc8de

Browse files
committed
Add configuration reference
1 parent 796cfb4 commit 0edc8de

File tree

1 file changed

+43
-1
lines changed

1 file changed

+43
-1
lines changed

README.md

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ $ bundle add rodauth-omniauth
1414
> Rodauth's CSRF protection will be used for the request validation phase, so there is no need for gems like `omniauth-rails_csrf_protection`.
1515
1616

17-
## Usage
17+
## Getting started
1818

1919
You'll first need to create the table for storing external identities:
2020

@@ -91,6 +91,48 @@ account.identities #=> [#<Account::Identity ...>, ...]
9191

9292
Currently, provider login is required to return the user's email address, and account creation is assumed not to require additional fields that need to be entered manually. There is currently also no built-in functionality for connecting/removing external identities when signed in. Both features are planned for future versions.
9393

94+
## Reference
95+
96+
### Auth Value Methods
97+
98+
| Method | Description |
99+
| ----- | ----------- |
100+
| `omniauth_verify_account?` | Automatically verify unverified accounts on login (defaults to true). |
101+
| `omniauth_login_unverified_account_error_flash` | Flash message for when existing account is unverified and automatic verification is disabled. |
102+
| `omniauth_login_failure_redirect` | Redirect location for when OmniAuth login failed. |
103+
| `omniauth_create_account?` | Automatically create account for new email address on OmniAuth login (defaults to true). |
104+
| `omniauth_login_no_matching_account_error_flash` | Flash message for when no existing account was found and automatic creation is disabled. |
105+
| `omniauth_two_factors?` | Teat OmniAuth login as two factors when using MFA (defaults to false). |
106+
| `omniauth_identities_table` | Table name for external identities (defaults to `:account_identities`). |
107+
| `omniauth_identities_id_column` | Primary key column for identities table (defaults to `:id`). |
108+
| `omniauth_identities_account_id_column` | Foreign key column for identities table (defaults to `:account_id`). |
109+
| `omniauth_identities_provider_column | Provider column for identities table (defaults to `:provider`). |
110+
| `omniauth_identities_uid_column | UID column for identities table (defaults to `:uid`). |
111+
| `omniauth_prefix` | Path prefix to use for OmniAuth routes (defaults to `/auth`). |
112+
| `omniauth_failure_error_flash` | Flash message for failed OmniAuth login. |
113+
| `omniauth_failure_redirect` | Redirect location for failed OmniAuth login. |
114+
| `omniauth_failure_error_status` | Response status for failed OmniAuth login (defaults to 500). |
115+
| `omniauth_authorize_url_key` | Field name for authorization URL in JSON mode. |
116+
| `omniauth_error_type_key` | Field name for error type in JSON mode. |
117+
118+
### Auth Methods
119+
120+
| Method | Description |
121+
| ----- | ----------- |
122+
| `account_from_omniauth` | Find an existing account from OmniAuth login data (by default matches by email). |
123+
| `before_omniauth_callback_route` | Run arbitrary code before handling the callback route. |
124+
| `omniauth_identity_insert_hash` | Hash of column values used for creating a new identity on login. |
125+
| `omniauth_identity_update_hash` | Hash of column values used fro updating existing identities on login. |
126+
| `before_omniauth_create_account` | Any actions to take before creating a new account on OmniAuth login. |
127+
| `after_omniauth_create_account` | Any actions to take after creating a new account on OmniAuth login. |
128+
| `omniauth_setup` | Hook for OmniAuth setup phase |
129+
| `omniauth_request_validation_phase` | Hook for OmniAuth request validation phase (defaults to CSRF protection.) |
130+
| `omniauth_before_request_phase` | Hook for OmniAuth before request phase. |
131+
| `omniauth_before_callback_phase` | Hook for OmniAuth before callback phase. |
132+
| `omniauth_on_failure` | Hook for OmniAuth login failure. |
133+
134+
## Customizing
135+
94136
### Timestamps
95137

96138
If you want to know when an external identity was used first or last, you may want to add timestamp columns to the identities table:

0 commit comments

Comments
 (0)