omniauth-slooob 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +7 -0
  2. data/.github/issue_template.md +14 -0
  3. data/.github/pull_request_template.md +21 -0
  4. data/.gitignore +22 -0
  5. data/.travis.yml +3 -0
  6. data/CHANGELOG.md +9 -0
  7. data/CODE_OF_CONDUCT.md +46 -0
  8. data/Gemfile +7 -0
  9. data/LICENSE +21 -0
  10. data/README.md +301 -0
  11. data/Rakefile +15 -0
  12. data/examples/omniauth.rb +31 -0
  13. data/examples/rails_example/.gitignore +27 -0
  14. data/examples/rails_example/Gemfile +54 -0
  15. data/examples/rails_example/README.md +24 -0
  16. data/examples/rails_example/Rakefile +6 -0
  17. data/examples/rails_example/app/assets/config/manifest.js +3 -0
  18. data/examples/rails_example/app/assets/images/.keep +0 -0
  19. data/examples/rails_example/app/assets/javascripts/application.js +15 -0
  20. data/examples/rails_example/app/assets/javascripts/books.coffee +3 -0
  21. data/examples/rails_example/app/assets/javascripts/cable.js +13 -0
  22. data/examples/rails_example/app/assets/javascripts/channels/.keep +0 -0
  23. data/examples/rails_example/app/assets/javascripts/sessions.coffee +3 -0
  24. data/examples/rails_example/app/assets/stylesheets/application.css +15 -0
  25. data/examples/rails_example/app/assets/stylesheets/books.scss +3 -0
  26. data/examples/rails_example/app/assets/stylesheets/scaffolds.scss +84 -0
  27. data/examples/rails_example/app/assets/stylesheets/sessions.scss +3 -0
  28. data/examples/rails_example/app/channels/application_cable/channel.rb +4 -0
  29. data/examples/rails_example/app/channels/application_cable/connection.rb +4 -0
  30. data/examples/rails_example/app/controllers/application_controller.rb +10 -0
  31. data/examples/rails_example/app/controllers/books_controller.rb +74 -0
  32. data/examples/rails_example/app/controllers/concerns/.keep +0 -0
  33. data/examples/rails_example/app/controllers/sessions_controller.rb +16 -0
  34. data/examples/rails_example/app/helpers/application_helper.rb +2 -0
  35. data/examples/rails_example/app/helpers/books_helper.rb +2 -0
  36. data/examples/rails_example/app/helpers/sessions_helper.rb +2 -0
  37. data/examples/rails_example/app/jobs/application_job.rb +2 -0
  38. data/examples/rails_example/app/mailers/application_mailer.rb +4 -0
  39. data/examples/rails_example/app/models/application_record.rb +3 -0
  40. data/examples/rails_example/app/models/book.rb +2 -0
  41. data/examples/rails_example/app/models/concerns/.keep +0 -0
  42. data/examples/rails_example/app/models/user.rb +12 -0
  43. data/examples/rails_example/app/views/books/_book.json.jbuilder +2 -0
  44. data/examples/rails_example/app/views/books/_form.html.erb +17 -0
  45. data/examples/rails_example/app/views/books/edit.html.erb +6 -0
  46. data/examples/rails_example/app/views/books/index.html.erb +25 -0
  47. data/examples/rails_example/app/views/books/index.json.jbuilder +1 -0
  48. data/examples/rails_example/app/views/books/new.html.erb +5 -0
  49. data/examples/rails_example/app/views/books/show.html.erb +4 -0
  50. data/examples/rails_example/app/views/books/show.json.jbuilder +1 -0
  51. data/examples/rails_example/app/views/layouts/application.html.erb +19 -0
  52. data/examples/rails_example/app/views/layouts/mailer.html.erb +13 -0
  53. data/examples/rails_example/app/views/layouts/mailer.text.erb +1 -0
  54. data/examples/rails_example/bin/bundle +3 -0
  55. data/examples/rails_example/bin/rails +4 -0
  56. data/examples/rails_example/bin/rake +4 -0
  57. data/examples/rails_example/bin/setup +38 -0
  58. data/examples/rails_example/bin/update +29 -0
  59. data/examples/rails_example/bin/yarn +11 -0
  60. data/examples/rails_example/config.ru +5 -0
  61. data/examples/rails_example/config/application.rb +18 -0
  62. data/examples/rails_example/config/boot.rb +3 -0
  63. data/examples/rails_example/config/cable.yml +10 -0
  64. data/examples/rails_example/config/database.yml +25 -0
  65. data/examples/rails_example/config/environment.rb +5 -0
  66. data/examples/rails_example/config/environments/development.rb +54 -0
  67. data/examples/rails_example/config/environments/production.rb +91 -0
  68. data/examples/rails_example/config/environments/test.rb +42 -0
  69. data/examples/rails_example/config/initializers/application_controller_renderer.rb +6 -0
  70. data/examples/rails_example/config/initializers/assets.rb +14 -0
  71. data/examples/rails_example/config/initializers/backtrace_silencers.rb +7 -0
  72. data/examples/rails_example/config/initializers/config.rb +36 -0
  73. data/examples/rails_example/config/initializers/cookies_serializer.rb +5 -0
  74. data/examples/rails_example/config/initializers/filter_parameter_logging.rb +4 -0
  75. data/examples/rails_example/config/initializers/inflections.rb +16 -0
  76. data/examples/rails_example/config/initializers/mime_types.rb +4 -0
  77. data/examples/rails_example/config/initializers/omniauth.rb +3 -0
  78. data/examples/rails_example/config/initializers/wrap_parameters.rb +14 -0
  79. data/examples/rails_example/config/locales/en.yml +33 -0
  80. data/examples/rails_example/config/puma.rb +56 -0
  81. data/examples/rails_example/config/routes.rb +10 -0
  82. data/examples/rails_example/config/secrets.yml +32 -0
  83. data/examples/rails_example/config/settings.yml +1 -0
  84. data/examples/rails_example/config/settings/development.yml +3 -0
  85. data/examples/rails_example/config/settings/production.yml +3 -0
  86. data/examples/rails_example/config/settings/test.yml +3 -0
  87. data/examples/rails_example/db/migrate/20170827120704_create_books.rb +8 -0
  88. data/examples/rails_example/db/migrate/20170827122351_create_users.rb +11 -0
  89. data/examples/rails_example/db/schema.rb +28 -0
  90. data/examples/rails_example/db/seeds.rb +7 -0
  91. data/examples/rails_example/lib/assets/.keep +0 -0
  92. data/examples/rails_example/lib/tasks/.keep +0 -0
  93. data/examples/rails_example/log/.keep +0 -0
  94. data/examples/rails_example/package.json +5 -0
  95. data/examples/rails_example/public/404.html +67 -0
  96. data/examples/rails_example/public/422.html +67 -0
  97. data/examples/rails_example/public/500.html +66 -0
  98. data/examples/rails_example/public/apple-touch-icon-precomposed.png +0 -0
  99. data/examples/rails_example/public/apple-touch-icon.png +0 -0
  100. data/examples/rails_example/public/favicon.ico +0 -0
  101. data/examples/rails_example/public/robots.txt +1 -0
  102. data/examples/rails_example/test/application_system_test_case.rb +5 -0
  103. data/examples/rails_example/test/controllers/.keep +0 -0
  104. data/examples/rails_example/test/controllers/books_controller_test.rb +48 -0
  105. data/examples/rails_example/test/controllers/sessions_controller_test.rb +9 -0
  106. data/examples/rails_example/test/fixtures/.keep +0 -0
  107. data/examples/rails_example/test/fixtures/books.yml +11 -0
  108. data/examples/rails_example/test/fixtures/files/.keep +0 -0
  109. data/examples/rails_example/test/fixtures/users.yml +9 -0
  110. data/examples/rails_example/test/helpers/.keep +0 -0
  111. data/examples/rails_example/test/integration/.keep +0 -0
  112. data/examples/rails_example/test/mailers/.keep +0 -0
  113. data/examples/rails_example/test/models/.keep +0 -0
  114. data/examples/rails_example/test/models/book_test.rb +7 -0
  115. data/examples/rails_example/test/models/user_test.rb +7 -0
  116. data/examples/rails_example/test/system/.keep +0 -0
  117. data/examples/rails_example/test/system/books_test.rb +9 -0
  118. data/examples/rails_example/test/test_helper.rb +9 -0
  119. data/examples/rails_example/vendor/.keep +0 -0
  120. data/lib/omniauth-slooob.rb +1 -0
  121. data/lib/omniauth/slooob.rb +1 -0
  122. data/lib/omniauth/slooob/version.rb +7 -0
  123. data/lib/omniauth/strategies/slooob.rb +95 -0
  124. data/omniauth-slooob.gemspec +28 -0
  125. data/test/test.rb +239 -0
  126. metadata +265 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: df30a1cc7eea71429f0cf5c6b8742145d09f8b0b
4
+ data.tar.gz: 37c23819f2910a5a0f07d433f5a67b2fca223d73
5
+ SHA512:
6
+ metadata.gz: 7bab1f82b57abaa51762fd9a7ed08b9eeb63cdb10bb2849b9059cacf59df176fdb7ad63fc0902954a2e75b8f51bf7d253c1fd5174a6d9c815bb31ded10227cd1
7
+ data.tar.gz: ada082ae2d3de4e86798241de1c495a93f64d128a4de8cfc5a61a8d6ad1a21299e2bf50af3f4f5c798ff8eae789ee8edacfa6ee998a8c3a833378f2b04157bd9
@@ -0,0 +1,14 @@
1
+ ### Expected behavior
2
+ Tell us what should happen
3
+
4
+ ### Actual behavior
5
+ Tell us what happens instead
6
+
7
+ ### Steps to reproduce
8
+ Show a way to reproduce
9
+
10
+ ### System configuration
11
+
12
+ **Ruby version**:
13
+
14
+ **Rails version**:
@@ -0,0 +1,21 @@
1
+ ### Summary
2
+
3
+ Provide a general description of the code changes in your pull
4
+ request... were there any bugs you had fixed? If so, mention them. If
5
+ these bugs have open GitHub issues, be sure to tag them here as well,
6
+ to keep the conversation linked together.
7
+
8
+ ### Other Information
9
+
10
+ If there's anything else that's important and relevant to your pull
11
+ request, mention that information here. This could include
12
+ benchmarks, or other information.
13
+
14
+ If you are updating any of the CHANGELOG files or are asked to update the
15
+ CHANGELOG files by reviewers, please add the CHANGELOG entry at the top of the file.
16
+
17
+ Finally, if your pull request affects documentation or any non-code
18
+ changes, guidelines for those changes are [available
19
+ here](https://github.com/slooob/acts_as_favoritor/blob/master/CONTRIBUTING.md)
20
+
21
+ Thanks for contributing to `acts_as_favoritor`!
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ .ruby-gemset
7
+ .ruby-version
8
+ .rvmrc
9
+ Gemfile.lock
10
+ InstalledFiles
11
+ _yardoc
12
+ coverage
13
+ doc/
14
+ lib/bundler/man
15
+ pkg
16
+ rdoc
17
+ spec/reports
18
+ test/tmp
19
+ test/version_tmp
20
+ tmp
21
+ .powenv
22
+ .idea/
@@ -0,0 +1,3 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.3.3
@@ -0,0 +1,9 @@
1
+ # Changelog
2
+
3
+ ## master
4
+
5
+ nothing yet
6
+
7
+ ## 1.0.0 - 2017-08-25
8
+
9
+ Initial release
@@ -0,0 +1,46 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ ## Our Standards
8
+
9
+ Examples of behavior that contributes to creating a positive environment include:
10
+
11
+ * Using welcoming and inclusive language
12
+ * Being respectful of differing viewpoints and experiences
13
+ * Gracefully accepting constructive criticism
14
+ * Focusing on what is best for the community
15
+ * Showing empathy towards other community members
16
+
17
+ Examples of unacceptable behavior by participants include:
18
+
19
+ * The use of sexualized language or imagery and unwelcome sexual attention or advances
20
+ * Trolling, insulting/derogatory comments, and personal or political attacks
21
+ * Public or private harassment
22
+ * Publishing others' private information, such as a physical or electronic address, without explicit permission
23
+ * Other conduct which could reasonably be considered inappropriate in a professional setting
24
+
25
+ ## Our Responsibilities
26
+
27
+ Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28
+
29
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30
+
31
+ ## Scope
32
+
33
+ This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34
+
35
+ ## Enforcement
36
+
37
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at help@slooob.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38
+
39
+ Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40
+
41
+ ## Attribution
42
+
43
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44
+
45
+ [homepage]: http://contributor-covenant.org
46
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+
6
+ # # Test Coverage
7
+ # gem 'simplecov', require: false, group: :test
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2017 Slooob
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,301 @@
1
+ # Slooob OAuth2 Strategy for OmniAuth
2
+
3
+ [![Build Status](https://travis-ci.org/slooob/omniauth-slooob.svg)](https://travis-ci.org/slooob/omniauth-slooob)
4
+ [![Gem Version](https://badge.fury.io/rb/omniauth-slooob.svg)](https://badge.fury.io/rb/omniauth-slooob)
5
+
6
+ **Built on Slooob Identity API v1**
7
+
8
+ Strategy to authenticate with Slooob via OAuth2 in OmniAuth.
9
+
10
+ Get your API key at: https://developer.slooob.com/dashboard/apps. Note the Client ID and the Client Secret.
11
+
12
+ ---
13
+
14
+ ## Table of Contents
15
+
16
+ * [Installation](#installation)
17
+ * [Slooob API Setup](#slooob-api-setup)
18
+ * [Usage](#usage)
19
+ * [Configuration](#configuration)
20
+ * [Auth Hash](#auth-hash)
21
+ * [Devise](#devise)
22
+ * [Testing](#testing)
23
+ * [Test Coverage](#test-coverage)
24
+ * [Contributing](#contributing)
25
+ * [Contributors](#contributors)
26
+ * [Semantic Versioning](#semantic-versioning)
27
+ * [License](#license)
28
+
29
+ ---
30
+
31
+ **Note**: You generate separate keys for development (sandbox) and production (live) with each application you register.
32
+ Use the [config Gem](https://rubygems.org/gems/config) to organize your keys and keep them safe.
33
+
34
+ For more details we encourage you to read the Slooob Auth API docs: https://developer.slooob.com/docs/api/identity/v1
35
+
36
+ ## Installation
37
+
38
+ Add to your `Gemfile`:
39
+
40
+ ```ruby
41
+ gem 'omniauth-slooob'
42
+ ```
43
+
44
+ And then execute:
45
+
46
+ $ bundle
47
+
48
+ Or install it yourself as:
49
+
50
+ $ gem install omniauth-slooob
51
+
52
+ ## Slooob API Setup
53
+
54
+ * Go to https://developer.slooob.com/dashboard/apps
55
+ * Select your app.
56
+ * Open the Manage APIs tab.
57
+ * Make sure 'Identity API' is enabled.
58
+ * Open the Credentials tab.
59
+ * Set `<YOURDOMAIN>/users/auth/slooob/callback` as Return URL for each 'sandbox' and 'live'.
60
+ * Now Save. It may take a few minutes for changes to take effect.
61
+
62
+ ## Usage
63
+
64
+ Here's an example for adding the middleware to a Rails app in `config/initializers/omniauth.rb`:
65
+
66
+ ```ruby
67
+ Rails.application.config.middleware.use OmniAuth::Builder do
68
+ provider :slooob, ENV['SLOOOB_KEY'], ENV['SLOOOB_SECRET']
69
+ end
70
+ ```
71
+
72
+ You can now access the OmniAuth Slooob OAuth2 URL: `/auth/slooob`
73
+
74
+ For more examples please take a look at `examples/omniauth.rb`
75
+
76
+ **Note**: While developing your application, if you change the scope in the initializer you will need to restart your app server. Remember that either the 'email' or 'public' scope is required!
77
+
78
+ ### Configuration
79
+
80
+ You can configure several options, which you pass in to the `provider` method via a hash:
81
+
82
+ * `scope`: A comma-separated list of permissions you want to request from the user. See the [Identity API docs](https://developer.slooob.com/docs/api/identity/v1/#permissions) for a full list of available permissions. Caveats:
83
+ * The `email` and `public` scopes are used by default. By defining your own `scope`, you override these defaults, but Slooob requires at least one of `email` or `public`, so make sure to add at least one of them to your scope!
84
+
85
+ * `redirect_uri`: Override the redirect_uri used by the gem.
86
+
87
+ * `incremental_authorization`: If this is provided with the value true, and the authorization request is granted, the authorization will include any previous authorizations granted to this user/application combination for other scopes. See Slooob's [Incremental Authorization](https://developer.slooob.com/docs/api/identity/v1/#incremental-authorization) for additional details.
88
+
89
+ * `image_size`: The size of the user's profile picture. Possible values:
90
+ * `raw`: 800x800px
91
+ * `big`: 350x350px
92
+ * `medium`: 100x100px
93
+ * `small`: 75x75px
94
+ * `tiny`: 50x50px
95
+ * Defaults to `raw`.
96
+
97
+ ### Auth Hash
98
+
99
+ Here's an example of an authentication hash available in the callback by accessing `request.env['omniauth.auth']`:
100
+
101
+ ```ruby
102
+ {
103
+ provider: "slooob",
104
+ uid: "bathjJwvdhKjgfgh8Jd745J7dh5Qkgflbnczd65dfnw",
105
+ info: {
106
+ email: "example@example.com",
107
+ username: "jony",
108
+ name: "John Smith",
109
+ first_name: "John",
110
+ last_name: "Smith",
111
+ description: "I love cats.",
112
+ image: "https://cdn.slooob.com/raw",
113
+ location: nil,
114
+ confirmed: true,
115
+ urls: {
116
+ website: "https://jonyscats.com",
117
+ slooob: "https://slooob.com/a/jony"
118
+ }
119
+ },
120
+ credentials: {
121
+ token: "token",
122
+ refresh_token: "refresh_token",
123
+ expires_at: 1355082790,
124
+ expires: true
125
+ },
126
+ extra: {
127
+ raw_info: {
128
+ username: "jony",
129
+ name: "John Smith",
130
+ first_name: "John",
131
+ last_name: "Smith",
132
+ description: "I love cats.",
133
+ avatar: {
134
+ raw: "https://cdn.slooob.com/raw",
135
+ big: "https://cdn.slooob.com/big",
136
+ medium: "https://cdn.slooob.com/medium",
137
+ small: "https://cdn.slooob.com/small",
138
+ tiny: "https://cdn.slooob.com/tiny"
139
+ },
140
+ location: nil,
141
+ latitude: nil,
142
+ longitude: nil,
143
+ phone: nil,
144
+ birthday: nil,
145
+ website: "https://jonyscats.com",
146
+ profile: "https://slooob.com/a/jony",
147
+ plan: "basic",
148
+ email_confirmed: true,
149
+ verified: false,
150
+ lang: "en",
151
+ status: "online",
152
+ id: 234345676578969343456,
153
+ created_at: 1259222400,
154
+ contacts_count: 2,
155
+ followers_count: 12,
156
+ following_count: 36,
157
+ favorites_count: 169,
158
+ watching_count: 532
159
+ }
160
+ }
161
+ }
162
+ ```
163
+
164
+ For more details see the Slooob [List Of Attributes](https://developer.slooob.com/docs/api/identity/v1/#attributes).
165
+
166
+ ### Devise
167
+
168
+ First define your application id and secret in `config/initializers/devise.rb`. Do not use the snippet mentioned in the [Usage](#usage) section.
169
+
170
+ ```ruby
171
+ require 'omniauth-slooob'
172
+ config.omniauth :slooob, ENV['SLOOOB_CLIENT_ID'], ENV['SLOOOB_CLIENT_SECRET']
173
+ ```
174
+
175
+ Then add the following to 'config/routes.rb' so the callback routes are defined.
176
+
177
+ ```ruby
178
+ devise_for :users, controllers: { omniauth_callbacks: 'users/omniauth_callbacks' }
179
+ ```
180
+
181
+ Make sure your model is `omniauthable`. In general this is defined in `app/models/user.rb`
182
+
183
+ ```ruby
184
+ devise :omniauthable, omniauth_providers: [:slooob]
185
+ ```
186
+
187
+ Then make sure your callbacks controller is setup.
188
+
189
+ ```ruby
190
+ class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
191
+ def paypal_oauth2
192
+ # You need to implement the method below in your model (e.g. app/models/user.rb)
193
+ @user = User.from_omniauth(request.env['omniauth.auth'])
194
+
195
+ if @user.persisted?
196
+ flash[:notice] = I18n.t 'devise.omniauth_callbacks.success', kind: 'Slooob'
197
+ sign_in_and_redirect @user, event: :authentication
198
+ else
199
+ session['devise.slooob_data'] = request.env['omniauth.auth']
200
+ redirect_to new_user_registration_url
201
+ end
202
+ end
203
+ end
204
+ ```
205
+
206
+ And bind to or create the user
207
+
208
+ ```ruby
209
+ def self.from_omniauth access_token
210
+ data = access_token.info
211
+ user = User.where(:email => data["email"]).first
212
+
213
+ # Uncomment the section below if you want users to be created if they don't exist
214
+ # unless user
215
+ # user = User.create(name: data["name"],
216
+ # email: data["email"],
217
+ # password: Devise.friendly_token[0,20]
218
+ # )
219
+ # end
220
+ user
221
+ end
222
+ ```
223
+
224
+ For your views you can login using:
225
+
226
+ ```erb
227
+ <%= link_to 'Sign in with Slooob', user_slooob_omniauth_authorize_path %>
228
+
229
+ <%# Devise prior 4.1.0: %>
230
+ <%= link_to 'Sign in with Slooob', user_omniauth_authorize_path(:slooob) %>
231
+ ```
232
+
233
+ An overview is available at https://github.com/plataformatec/devise/wiki/OmniAuth:-Overview
234
+
235
+ ---
236
+
237
+ ## Testing
238
+
239
+ Tests are written with Shoulda. Tests are run using rake.
240
+
241
+ 1. Fork this repository
242
+ 2. Clone your forked git locally
243
+ 3. Install dependencies
244
+
245
+ `$ bundle install`
246
+
247
+ 4. Run tests
248
+
249
+ `$ rake test`
250
+
251
+ ### Test Coverage
252
+
253
+ Test coverage can be calculated using SimpleCov. Make sure you have the [simplecov gem](https://github.com/colszowka/simplecov) installed.
254
+
255
+ 1. Uncomment SimpleCov in the Gemfile
256
+ 2. Uncomment the relevant section in `test/test_helper.rb`
257
+ 3. Run tests
258
+
259
+ `$ rake test`
260
+
261
+ ---
262
+
263
+ ## Contributing
264
+
265
+ We hope that you will consider contributing to omniauth-slooob. Please read this short overview for some information about how to get started:
266
+
267
+ [Learn more about contributing to this repository](https://github.com/slooob/omniauth-slooob/blob/master/CONTRIBUTING.md), [Code of Conduct](https://github.com/slooob/omniauth-slooob/blob/master/CODE_OF_CONDUCT.md)
268
+
269
+ ### Contributors
270
+
271
+ Give the people some :heart: who are working on this project. See them all at:
272
+
273
+ https://github.com/slooob/omniauth-slooob/graphs/contributors
274
+
275
+ ### Semantic Versioning
276
+
277
+ omniauth-slooob follows Semantic Versioning 2.0 as defined at http://semver.org.
278
+
279
+ ## License
280
+
281
+ MIT License
282
+
283
+ Copyright (c) 2017 Slooob
284
+
285
+ Permission is hereby granted, free of charge, to any person obtaining a copy
286
+ of this software and associated documentation files (the "Software"), to deal
287
+ in the Software without restriction, including without limitation the rights
288
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
289
+ copies of the Software, and to permit persons to whom the Software is
290
+ furnished to do so, subject to the following conditions:
291
+
292
+ The above copyright notice and this permission notice shall be included in all
293
+ copies or substantial portions of the Software.
294
+
295
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
296
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
297
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
298
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
299
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
300
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
301
+ SOFTWARE.