You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 22, 2021. It is now read-only.
Note that the `authenticate` method depends upon the `current_user` method. Overwriting `current_user` in the controller may break the `authenticate` method.
165
+
-**Modify the token payload**
166
+
167
+
By default the token payload contains the entity's id inside the subject (`sub`) claim.
168
+
If you want to modify this behaviour, implement within your entity model an instance method
169
+
`to_token_payload` that returns a hash representing the payload.
170
+
171
+
E.g.
172
+
173
+
```ruby
174
+
classUser < ActiveRecord::Base
175
+
defto_token_payload
176
+
# Returns the payload as a hash
177
+
end
178
+
end
179
+
```
180
+
181
+
#### Via the initializer
182
+
183
+
The initializer [config/initializers/knock.rb](https://github.com/nsarno/knock/blob/master/lib/generators/templates/knock.rb)
184
+
is generated when `rails g knock:install` is executed. Each configuration variable is
185
+
documented with comments in the initializer itself.
127
186
128
-
### Authenticating from a web or mobile application:
187
+
### Authenticating from a web or mobile application
warn"[DEPRECATION]: Routing to `AuthTokenController` directly is deprecated. Please use `<Entity Name>TokenController` inheriting from it instead. E.g. `UserTokenController`"
30
+
warn"[DEPRECATION]: Relying on `Knock.current_user_from_handle` is deprecated. Please implement `User#from_token_request` instead."
0 commit comments