README.md in matic-jwt-1.0.1 vs README.md in matic-jwt-1.1.0
- old
+ new
@@ -1,11 +1,9 @@
# Matic::Jwt
-Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/matic/jwt`. To experiment with that code, run `bin/console` for an interactive prompt.
+Matic's implementation of JWT authentication.
-TODO: Delete this and the text above, and describe your gem
-
## Installation
Add this line to your application's Gemfile:
```ruby
@@ -20,10 +18,33 @@
$ gem install matic-jwt
## Usage
-TODO: Write usage instructions here
+####With Grape
+
+Use ```:jwt_auth``` strategy and provide secret.
+```ruby
+ auth :jwt_auth, {
+ secret: -> (client_name) { ::ApiClient.find_by!(name: client_name).secret }
+ }
+```
+If you need to get any data from authentication payload use ::MaticJWT::Grape::Helper.
+```ruby
+ module ApiHelper
+ include ::MaticJWT::Grape::Helper
+
+ def current_client
+ @current_client ||= ::ApiClient.find_by!(name: client_name)
+ end
+
+ private
+
+ def client_name
+ auth_payload['client_name']
+ end
+ end
+```
## Development
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.