Skip to content

Commit d3a8a84

Browse files
Merge pull request #380 from brettchaldecott/feat/rails_engine_mount
Feat/rails engine mount
2 parents 9a30880 + 8b0db42 commit d3a8a84

File tree

1 file changed

+37
-1
lines changed

1 file changed

+37
-1
lines changed

src/content/docs/developer-tools/sdks/backend/ruby-sdk.mdx

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,14 @@ To enable the AuthController, you need to add the following routes to your `conf
147147
get "client_credentials_auth" => "auth#client_credentials_auth"
148148
end
149149
```
150-
### Usage
150+
151+
If you decide instead to use the rails engine, you can add the following to your `config/routes.rb` file:
152+
153+
```ruby
154+
mount KindeSdk::Engine, at: "/kinde_sdk"
155+
```
156+
157+
### Usage the AuthController in your application
151158
To use the AuthController consume the routes in your application. For example in a Rails view file use the auth path to trigger the login flow:
152159

153160
```ruby
@@ -157,6 +164,35 @@ To use the AuthController consume the routes in your application. For example in
157164
</a>
158165
</div>
159166
```
167+
The full list of paths exposed by the controller are the following:
168+
169+
```ruby
170+
kinde_sdk_auth_path
171+
kinde_sdk_callback_path
172+
kinde_sdk_logout_path
173+
kinde_sdk_logout_callback_path
174+
kinde_sdk_client_credentials_auth_path
175+
```
176+
177+
#### Using the engine
178+
When using the AuthController with the engine your application can use the paths as follows:
179+
180+
```ruby
181+
<div class="buttons">
182+
<a class="button is-primary" href="<%= kinde_sdk.auth_path %>">
183+
<strong>Log in</strong>
184+
</a>
185+
</div>
186+
```
187+
The full list of paths exposed by the engine are the following:
188+
189+
```ruby
190+
kinde_sdk.auth_path
191+
kinde_sdk.callback_path
192+
kinde_sdk.logout_path
193+
kinde_sdk.logout_callback_path
194+
kinde_sdk.client_credentials_auth_path
195+
```
160196

161197
## Sign in and registration
162198

0 commit comments

Comments
 (0)