質問編集履歴
6
タグの追加
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|
5
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -312,4 +312,4 @@
|
|
312
312
|
|
313
313
|
|
314
314
|
|
315
|
-
|
315
|
+
よろしくお願いいたします。
|
4
書式の改善 リンク化しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -10,7 +10,9 @@
|
|
10
10
|
|
11
11
|
###発生している問題・エラーメッセージ
|
12
12
|
|
13
|
-
facebookログインボタンを押すとエラーメッセージ①
|
13
|
+
facebookログインボタンを押すと[エラーメッセージ①](https://gyazo.com/ccbb419f73be876c07e22388b42661fb)
|
14
|
+
|
15
|
+
が出て、さらに「ok」を押すと[エラーメッセージ②](https://gyazo.com/2fa935cf81d877f2239ac7bfbe1cfc58)が出てしまいます。
|
14
16
|
|
15
17
|
###config>routes.rb
|
16
18
|
|
@@ -296,27 +298,17 @@
|
|
296
298
|
|
297
299
|
```
|
298
300
|
|
299
|
-
###
|
301
|
+
###facebook開発者設定
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
エラーメッセージ①↓
|
304
|
-
|
305
|
-
https://gyazo.com/ccbb419f73be876c07e22388b42661fb
|
306
|
-
|
307
|
-
エラーメッセージ②↓
|
308
|
-
|
309
|
-
https://gyazo.com/2fa935cf81d877f2239ac7bfbe1cfc58
|
310
302
|
|
311
303
|
facebook開発者設定(Basic)↓
|
312
304
|
|
313
|
-
https://gyazo.com/b7388eb81884663b756c6d925265ef5b
|
305
|
+
[https://gyazo.com/b7388eb81884663b756c6d925265ef5b](https://gyazo.com/b7388eb81884663b756c6d925265ef5b)
|
314
306
|
|
315
307
|
facebook開発者設定(Advanced)↓
|
316
308
|
|
317
|
-
https://gyazo.com/b1aa201f774e20ad258d096f1d99a42f
|
309
|
+
[https://gyazo.com/b1aa201f774e20ad258d096f1d99a42f](https://gyazo.com/b1aa201f774e20ad258d096f1d99a42f)
|
318
|
-
|
310
|
+
|
319
|
-
https://gyazo.com/6c05e5e1e23c643fbe331e34b7ec78f9
|
311
|
+
[https://gyazo.com/6c05e5e1e23c643fbe331e34b7ec78f9](https://gyazo.com/6c05e5e1e23c643fbe331e34b7ec78f9)
|
320
312
|
|
321
313
|
|
322
314
|
|
3
書式の改善
test
CHANGED
File without changes
|
test
CHANGED
@@ -38,7 +38,7 @@
|
|
38
38
|
|
39
39
|
```
|
40
40
|
|
41
|
-
|
41
|
+
|
42
42
|
|
43
43
|
###vender>Gemfile
|
44
44
|
|
2
文章追加
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Facebookログインで
|
1
|
+
FacebookログインでNoAuthorizationCodeErrorが出て困っています。
|
test
CHANGED
@@ -4,7 +4,9 @@
|
|
4
4
|
|
5
5
|
Ruby on Railsでfacebookログイン機能を追加したいのですが、エラーが出てしまいます。
|
6
6
|
|
7
|
-
|
7
|
+
どうしたらこのエラーは消えるのでしょうか?
|
8
|
+
|
9
|
+
よろしくお願いします。
|
8
10
|
|
9
11
|
###発生している問題・エラーメッセージ
|
10
12
|
|
@@ -32,262 +34,264 @@
|
|
32
34
|
|
33
35
|
|
34
36
|
|
37
|
+
end```
|
38
|
+
|
39
|
+
```
|
40
|
+
|
41
|
+
```
|
42
|
+
|
43
|
+
###vender>Gemfile
|
44
|
+
|
45
|
+
```ここに言語を入力
|
46
|
+
|
47
|
+
source 'https://rubygems.org'
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
|
54
|
+
|
55
|
+
gem 'rails', '4.2.4'
|
56
|
+
|
57
|
+
# Use mysql as the database for Active Record
|
58
|
+
|
59
|
+
gem 'mysql2', '0.3.18'
|
60
|
+
|
61
|
+
# Use SCSS for stylesheets
|
62
|
+
|
63
|
+
gem 'sass-rails', '~> 4.0.2'
|
64
|
+
|
65
|
+
# Use Uglifier as compressor for JavaScript assets
|
66
|
+
|
67
|
+
gem 'uglifier', '>= 1.3.0'
|
68
|
+
|
69
|
+
# Use CoffeeScript for .coffee assets and views
|
70
|
+
|
71
|
+
gem 'coffee-rails', '~> 4.1.0'
|
72
|
+
|
73
|
+
# See https://github.com/rails/execjs#readme for more supported runtimes
|
74
|
+
|
75
|
+
gem 'therubyracer', platforms: :ruby
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
# Use jquery as the JavaScript library
|
80
|
+
|
81
|
+
gem 'jquery-rails'
|
82
|
+
|
83
|
+
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
|
84
|
+
|
85
|
+
gem 'turbolinks'
|
86
|
+
|
87
|
+
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
|
88
|
+
|
89
|
+
gem 'jbuilder', '~> 2.0'
|
90
|
+
|
91
|
+
# bundle exec rake doc:rails generates the API under doc/api.
|
92
|
+
|
93
|
+
gem 'sdoc', '~> 0.4.0', group: :doc
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
# Use ActiveModel has_secure_password
|
98
|
+
|
99
|
+
# gem 'bcrypt', '~> 3.1.7'
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
# Use Unicorn as the app server
|
104
|
+
|
105
|
+
# gem 'unicorn'
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
# Use Capistrano for deployment
|
110
|
+
|
111
|
+
# gem 'capistrano-rails', group: :development
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
group :development, :test do
|
116
|
+
|
117
|
+
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
118
|
+
|
119
|
+
gem 'byebug'
|
120
|
+
|
35
121
|
end
|
36
122
|
|
37
|
-
|
123
|
+
|
38
|
-
|
124
|
+
|
39
|
-
|
125
|
+
group :development do
|
40
|
-
|
41
|
-
|
126
|
+
|
42
|
-
|
43
|
-
source 'https://rubygems.org'
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
# B
|
127
|
+
# Access an IRB console on exception pages or by using <%= console %> in views
|
50
|
-
|
51
|
-
|
128
|
+
|
52
|
-
|
53
|
-
# Use mysql as the database for Active Record
|
54
|
-
|
55
|
-
gem 'mysql2', '0.3.18'
|
56
|
-
|
57
|
-
# Use SCSS for stylesheets
|
58
|
-
|
59
|
-
gem 's
|
129
|
+
gem 'web-console', '~> 2.0'
|
60
|
-
|
61
|
-
|
130
|
+
|
62
|
-
|
63
|
-
|
131
|
+
|
64
|
-
|
65
|
-
|
132
|
+
|
66
|
-
|
67
|
-
gem 'coffee-rails', '~> 4.1.0'
|
68
|
-
|
69
|
-
# See https://github.com/rails/
|
133
|
+
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
|
70
|
-
|
134
|
+
|
71
|
-
gem '
|
135
|
+
gem 'spring'
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
136
|
+
|
76
|
-
|
77
|
-
gem '
|
137
|
+
gem 'pry-rails'
|
78
|
-
|
138
|
+
|
79
|
-
|
139
|
+
gem 'compass-rails','~> 2.0'
|
140
|
+
|
80
|
-
|
141
|
+
gem 'sprockets', '2.11.0'
|
142
|
+
|
81
|
-
gem '
|
143
|
+
gem 'kaminari'
|
82
|
-
|
83
|
-
|
144
|
+
|
84
|
-
|
85
|
-
gem '
|
145
|
+
gem 'omniauth', '~> 1.2.1'
|
86
|
-
|
87
|
-
|
146
|
+
|
88
|
-
|
89
|
-
gem '
|
147
|
+
gem 'omniauth-twitter', '~> 1.0.1'
|
90
|
-
|
91
|
-
|
92
|
-
|
148
|
+
|
93
|
-
|
149
|
+
gem 'omniauth-facebook'
|
94
|
-
|
150
|
+
|
95
|
-
|
151
|
+
gem 'ransack', '~> 1.2.2'
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
# Use Unicorn as the app server
|
100
|
-
|
101
|
-
# gem 'unicorn'
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
# Use Capistrano for deployment
|
106
|
-
|
107
|
-
# gem 'capistrano-rails', group: :development
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
group :development, :test do
|
112
|
-
|
113
|
-
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
|
114
|
-
|
115
|
-
gem 'byebug'
|
116
152
|
|
117
153
|
end
|
118
154
|
|
119
|
-
|
120
|
-
|
121
|
-
gr
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
ge
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
g
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
155
|
+
```
|
156
|
+
|
157
|
+
###config>secrets.yml
|
158
|
+
|
159
|
+
```ここに言語を入力
|
160
|
+
|
161
|
+
# Be sure to restart your server when you modify this file.
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
# Your secret key is used for verifying the integrity of signed cookies.
|
166
|
+
|
167
|
+
# If you change this key, all old signed cookies will become invalid!
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
# Make sure the secret is at least 30 characters and all random,
|
172
|
+
|
173
|
+
# no regular words or you'll be exposed to dictionary attacks.
|
174
|
+
|
175
|
+
# You can use `rake secret` to generate a secure secret key.
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
# Make sure the secrets in this file are kept private
|
180
|
+
|
181
|
+
# if you're sharing your code publicly.
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
default_twitter: &default_twitter
|
186
|
+
|
187
|
+
twitter_api_key: 'xxx'
|
188
|
+
|
189
|
+
twitter_api_secret: 'xxx'
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
default_facebook: &default_facebook
|
194
|
+
|
195
|
+
facebook_api_key: 'xxx'
|
196
|
+
|
197
|
+
facebook_api_secret: 'xxx'
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
development:
|
202
|
+
|
203
|
+
secret_key_base: xxxxxxxxxxxxx
|
204
|
+
|
205
|
+
<<: *default_twitter
|
206
|
+
|
207
|
+
<<: *default_facebook
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
test:
|
212
|
+
|
213
|
+
secret_key_base: xxxxxxxxxxxxxxx
|
214
|
+
|
215
|
+
<<: *default_twitter
|
216
|
+
|
217
|
+
<<: *default_facebook
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
# Do not keep production secrets in the repository,
|
222
|
+
|
223
|
+
# instead read values from the environment.
|
224
|
+
|
225
|
+
production:
|
226
|
+
|
227
|
+
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
228
|
+
|
229
|
+
twitter_api_key: <%= ENV["TWITTER_CONSUMER_KEY"] %>
|
230
|
+
|
231
|
+
twitter_api_secret: <%= ENV["TWITTER_CONSUMER_SECRET"] %>
|
232
|
+
|
233
|
+
facebook_api_key: <%= ENV["FACEBOOK_API_KEY"] %>
|
234
|
+
|
235
|
+
facebook_api_secret: <%= ENV["FACEBOOK_API_SECRET"] %>
|
236
|
+
|
237
|
+
```
|
238
|
+
|
239
|
+
###config>initializers>omniauth.rb
|
240
|
+
|
241
|
+
```ここに言語を入力
|
242
|
+
|
243
|
+
Rails.application.config.middleware.use OmniAuth::Builder do
|
244
|
+
|
245
|
+
provider :twitter,
|
246
|
+
|
247
|
+
Rails.application.secrets.twitter_api_key,
|
248
|
+
|
249
|
+
Rails.application.secrets.twitter_api_secret
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
provider :facebook,
|
254
|
+
|
255
|
+
Rails.application.secrets.facebook_api_key,
|
256
|
+
|
257
|
+
Rails.application.secrets.facebook_api_secret
|
148
258
|
|
149
259
|
end
|
150
260
|
|
151
261
|
```
|
152
262
|
|
153
|
-
###
|
154
|
-
|
155
|
-
```ここに言語を入力
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
twitter_api_key: 'xxx'
|
184
|
-
|
185
|
-
twitter_api_secret: 'xxx'
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
default_facebook: &default_facebook
|
190
|
-
|
191
|
-
facebook_api_key: 'xxx'
|
192
|
-
|
193
|
-
facebook_api_secret: 'xxx'
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
development:
|
198
|
-
|
199
|
-
secret_key_base: xxxxxxxxxxxxx
|
200
|
-
|
201
|
-
<<: *default_twitter
|
202
|
-
|
203
|
-
<<: *default_facebook
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
test:
|
208
|
-
|
209
|
-
secret_key_base: xxxxxxxxxxxxxxx
|
210
|
-
|
211
|
-
<<: *default_twitter
|
212
|
-
|
213
|
-
<<: *default_facebook
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
# Do not keep production secrets in the repository,
|
218
|
-
|
219
|
-
# instead read values from the environment.
|
220
|
-
|
221
|
-
production:
|
222
|
-
|
223
|
-
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
|
224
|
-
|
225
|
-
twitter_api_key: <%= ENV["TWITTER_CONSUMER_KEY"] %>
|
226
|
-
|
227
|
-
twitter_api_secret: <%= ENV["TWITTER_CONSUMER_SECRET"] %>
|
228
|
-
|
229
|
-
facebook_api_key: <%= ENV["FACEBOOK_API_KEY"] %>
|
230
|
-
|
231
|
-
facebook_api_secret: <%= ENV["FACEBOOK_API_SECRET"] %>
|
232
|
-
|
233
|
-
```
|
234
|
-
|
235
|
-
###config>initializers>omniauth.rb
|
236
|
-
|
237
|
-
```ここに言語を入力
|
238
|
-
|
239
|
-
Rails.application.config.middleware.use OmniAuth::Builder do
|
240
|
-
|
241
|
-
provider :twitter,
|
242
|
-
|
243
|
-
Rails.application.secrets.twitter_api_key,
|
244
|
-
|
245
|
-
Rails.application.secrets.twitter_api_secret
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
provider :facebook,
|
250
|
-
|
251
|
-
Rails.application.secrets.facebook_api_key,
|
252
|
-
|
253
|
-
Rails.application.secrets.facebook_api_secret
|
263
|
+
###db>migrate>20160218092058_create_users.rb
|
264
|
+
|
265
|
+
```ここに言語を入力
|
266
|
+
|
267
|
+
class CreateUsers < ActiveRecord::Migration
|
268
|
+
|
269
|
+
def change
|
270
|
+
|
271
|
+
create_table :users do |t|
|
272
|
+
|
273
|
+
t.string :provider, null: false
|
274
|
+
|
275
|
+
t.string :uid, null: false
|
276
|
+
|
277
|
+
t.string :nickname, null: false
|
278
|
+
|
279
|
+
t.string :image_url, null: false
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
t.timestamps
|
284
|
+
|
285
|
+
end
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
add_index :users, [:provider, :uid], unique: true
|
290
|
+
|
291
|
+
end
|
254
292
|
|
255
293
|
end
|
256
294
|
|
257
|
-
```
|
258
|
-
|
259
|
-
###db>migrate>20160218092058_create_users.rb
|
260
|
-
|
261
|
-
```ここに言語を入力
|
262
|
-
|
263
|
-
class CreateUsers < ActiveRecord::Migration
|
264
|
-
|
265
|
-
def change
|
266
|
-
|
267
|
-
create_table :users do |t|
|
268
|
-
|
269
|
-
t.string :provider, null: false
|
270
|
-
|
271
|
-
t.string :uid, null: false
|
272
|
-
|
273
|
-
t.string :nickname, null: false
|
274
|
-
|
275
|
-
t.string :image_url, null: false
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
t.timestamps
|
280
|
-
|
281
|
-
end
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
add_index :users, [:provider, :uid], unique: true
|
286
|
-
|
287
|
-
end
|
288
|
-
|
289
|
-
end
|
290
|
-
|
291
295
|
|
292
296
|
|
293
297
|
```
|
1
誤字
test
CHANGED
File without changes
|
test
CHANGED
@@ -260,113 +260,33 @@
|
|
260
260
|
|
261
261
|
```ここに言語を入力
|
262
262
|
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
de
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
pool: 5
|
292
|
-
|
293
|
-
username: root
|
294
|
-
|
295
|
-
password:
|
296
|
-
|
297
|
-
socket: /tmp/mysql.sock
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
development:
|
302
|
-
|
303
|
-
<<: *default
|
304
|
-
|
305
|
-
database: numachannel_development
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
# Warning: The database defined as "test" will be erased and
|
310
|
-
|
311
|
-
# re-generated from your development database when you run "rake".
|
312
|
-
|
313
|
-
# Do not set this db to the same as development or production.
|
314
|
-
|
315
|
-
test:
|
316
|
-
|
317
|
-
<<: *default
|
318
|
-
|
319
|
-
database: numachannel_test
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
# As with config/secrets.yml, you never want to store sensitive information,
|
324
|
-
|
325
|
-
# like your database password, in your source code. If your source code is
|
326
|
-
|
327
|
-
# ever seen by anyone, they now have access to your database.
|
328
|
-
|
329
|
-
#
|
330
|
-
|
331
|
-
# Instead, provide the password as a unix environment variable when you boot
|
332
|
-
|
333
|
-
# the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
|
334
|
-
|
335
|
-
# for a full rundown on how to provide these environment variables in a
|
336
|
-
|
337
|
-
# production deployment.
|
338
|
-
|
339
|
-
#
|
340
|
-
|
341
|
-
# On Heroku and other platform providers, you may have a full connection URL
|
342
|
-
|
343
|
-
# available as an environment variable. For example:
|
344
|
-
|
345
|
-
#
|
346
|
-
|
347
|
-
# DATABASE_URL="mysql2://myuser:mypass@localhost/somedatabase"
|
348
|
-
|
349
|
-
#
|
350
|
-
|
351
|
-
# You can use this database configuration with:
|
352
|
-
|
353
|
-
#
|
354
|
-
|
355
|
-
# production:
|
356
|
-
|
357
|
-
# url: <%= ENV['DATABASE_URL'] %>
|
358
|
-
|
359
|
-
#
|
360
|
-
|
361
|
-
production:
|
362
|
-
|
363
|
-
<<: *default
|
364
|
-
|
365
|
-
database: numachannel_production
|
366
|
-
|
367
|
-
username: numachannel
|
368
|
-
|
369
|
-
password: <%= ENV['NUMACHANNEL_DATABASE_PASSWORD'] %>
|
263
|
+
class CreateUsers < ActiveRecord::Migration
|
264
|
+
|
265
|
+
def change
|
266
|
+
|
267
|
+
create_table :users do |t|
|
268
|
+
|
269
|
+
t.string :provider, null: false
|
270
|
+
|
271
|
+
t.string :uid, null: false
|
272
|
+
|
273
|
+
t.string :nickname, null: false
|
274
|
+
|
275
|
+
t.string :image_url, null: false
|
276
|
+
|
277
|
+
|
278
|
+
|
279
|
+
t.timestamps
|
280
|
+
|
281
|
+
end
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
add_index :users, [:provider, :uid], unique: true
|
286
|
+
|
287
|
+
end
|
288
|
+
|
289
|
+
end
|
370
290
|
|
371
291
|
|
372
292
|
|