質問編集履歴

9

追記

2019/05/16 08:06

投稿

django
django

スコア19

test CHANGED
File without changes
test CHANGED
@@ -8,9 +8,9 @@
8
8
 
9
9
  なのでまずhtmlからuserIDを入力後対象の会議リストを取得しようとしています。
10
10
 
11
- useIDなどを組み込んだトークン作成ができていません。
11
+ useIDなどを組み込んだトークン作成ができません。
12
-
12
+
13
- ようにて正くトークンが作成されますでしょうか
13
+ 何かご存知方おりまたらお願いいたします。
14
14
 
15
15
  ### 該当のソースコード
16
16
 

8

追記

2019/05/16 08:06

投稿

django
django

スコア19

test CHANGED
File without changes
test CHANGED
@@ -46,6 +46,8 @@
46
46
 
47
47
  def about(request):
48
48
 
49
+ mail = request.post['mail']
50
+
49
51
  cosole.log('mail')
50
52
 
51
53
  ApiKey = 'zzz'
@@ -142,7 +144,7 @@
142
144
 
143
145
  <h1>userID</h1>
144
146
 
145
- <form acition="{%url 'about'%}"method="get">
147
+ <form acition="{%url 'about'%}"method="post">
146
148
 
147
149
  {% csrf_token %}
148
150
 

7

追記

2019/05/16 08:04

投稿

django
django

スコア19

test CHANGED
File without changes
test CHANGED
@@ -8,11 +8,7 @@
8
8
 
9
9
  なのでまずhtmlからuserIDを入力後対象の会議リストを取得しようとしています。
10
10
 
11
- 現状、認証するボタン押すとURLにトークンにみたいなものが作成されるのすが
11
+ useIDなど組み込んだトークン作成きていません。
12
-
13
- https://jwt.io/
14
-
15
- 上記サイトで貼り付けするとエラーが出ます。
16
12
 
17
13
  どのようにして正しくトークンが作成されますでしょうか。
18
14
 

6

追記

2019/05/16 07:29

投稿

django
django

スコア19

test CHANGED
File without changes
test CHANGED
@@ -8,198 +8,198 @@
8
8
 
9
9
  なのでまずhtmlからuserIDを入力後対象の会議リストを取得しようとしています。
10
10
 
11
- 現状、tokenの作成ができて、URL出力され
11
+ 現状、認証するボタンを押すとURLにトークンにみたいなものが作成されるので
12
+
12
-
13
+ https://jwt.io/
14
+
15
+ 上記サイトで貼り付けするとエラーが出ます。
16
+
17
+ どのようにして正しくトークンが作成されますでしょうか。
18
+
19
+ ### 該当のソースコード
20
+
21
+
22
+
23
+ ```views.py
24
+
25
+ from django.shortcuts import render
26
+
27
+ from django.http import HttpResponse
28
+
29
+
30
+
31
+ import jwt
32
+
33
+ import requests
34
+
35
+
36
+
37
+ def index(request):
38
+
39
+
40
+
41
+ params={
42
+
43
+ 'mail':'',
44
+
45
+ }
46
+
47
+ return render(request,'api/index.html',params)
48
+
49
+
50
+
51
+ def about(request):
52
+
53
+ cosole.log('mail')
54
+
55
+ ApiKey = 'zzz'
56
+
57
+ ApiSercret = 'zzz'
58
+
59
+
60
+
61
+
62
+
63
+ #token作成
64
+
65
+ payload = {
66
+
67
+ 'iss': 'ApiKey',
68
+
69
+ 'exp': datetime.now().strftime("%Y/%m/%d %H:%M:%S") + 10000
70
+
71
+ }
72
+
13
- ですが、token作成からどのようにAPIを取得するのかがわかりません。
73
+ token = jwt.sign(payload,APISecret)
74
+
75
+
76
+
77
+
78
+
79
+
80
+
81
+
82
+
14
-
83
+ options = {
84
+
85
+ uri:'https://api.zoom.us/v2/users/'+{mail}+'/meetings',
86
+
87
+ qs:{
88
+
89
+ status:'active'
90
+
91
+ },
92
+
93
+ auth:{
94
+
95
+ 'bearer':token
96
+
97
+ },
98
+
99
+ headers:{
100
+
101
+ 'User-Agent':'Zoom-api-Jwt-Request',
102
+
103
+ 'content-type':'application/json'
104
+
105
+ },
106
+
107
+ json:true
108
+
109
+ }
110
+
111
+ if requests.post(options):
112
+
113
+ console.log('User has', response)
114
+
115
+ console.log(token)
116
+
117
+ console.log(JSON.stringify(resp, null, 2))
118
+
119
+ else:
120
+
121
+ console.log('API call failed, reason ', err)
122
+
123
+
124
+
125
+ return render(request,'/about.html',token)
126
+
127
+
128
+
129
+ ```
130
+
131
+ ```index.html
132
+
133
+ <!doctype html>
134
+
135
+ <html lang="ja">
136
+
137
+ <head>
138
+
139
+ <meta charset="utf-8" />
140
+
141
+ <title>api</title>
142
+
143
+ </head>
144
+
145
+ <body>
146
+
147
+ <h1>userID</h1>
148
+
149
+ <form acition="{%url 'about'%}"method="get">
150
+
151
+ {% csrf_token %}
152
+
153
+ <p>userID</p>
154
+
155
+ <input type="tel" placeholder="UserID" value="{{ 'mail' }}">
156
+
157
+ <input type="submit" value="認証する">
158
+
159
+ </form>
160
+
161
+ </body>
162
+
163
+ </html>
164
+
165
+ ```
166
+
167
+ ```urls.py
168
+
169
+ from django.contrib import admin
170
+
171
+ from django.urls import path
172
+
173
+ from rest_framework_jwt.views import obtain_jwt_token
174
+
175
+ from . import views #�NjL
176
+
177
+
178
+
179
+ urlpatterns = [
180
+
181
+ path('admin/', admin.site.urls),
182
+
183
+ path('',views.index,name='index'),
184
+
185
+ path('about/',views.about,name='about')
186
+
187
+ #path('jwt-token/', obtain_jwt_token),
188
+
189
+ #path('ping', views.PingViewSet.as_view()), # �NjL
190
+
191
+ ]
192
+
193
+ ```
194
+
195
+
196
+
197
+ ### 試したこと
198
+
15
- 以下URLではusesAPIなど取得できています。
199
+ 以下サイトを使用し、トークン作成試みています。
16
200
 
17
201
  http://r9.hateblo.jp/entry/2018/01/30/081534
18
202
 
19
- どのように取得するのでしょうか。
20
-
21
- ### 該当のソースコード
22
-
23
-
24
-
25
- ```views.py
26
-
27
- from django.shortcuts import render
28
-
29
- from django.http import HttpResponse
30
-
31
-
32
-
33
- import jwt
34
-
35
- import requests
36
-
37
-
38
-
39
- def index(request):
40
-
41
-
42
-
43
- params={
44
-
45
- 'mail':'',
46
-
47
- }
48
-
49
- return render(request,'api/index.html',params)
50
-
51
-
52
-
53
- def about(request):
54
-
55
- cosole.log('mail')
56
-
57
- ApiKey = 'zzz'
58
-
59
- ApiSercret = 'zzz'
60
-
61
-
62
-
63
-
64
-
65
- #token作成
66
-
67
- payload = {
68
-
69
- 'iss': 'ApiKey',
70
-
71
- 'exp': datetime.now().strftime("%Y/%m/%d %H:%M:%S") + 10000
72
-
73
- }
74
-
75
- token = jwt.sign(payload,APISecret)
76
-
77
-
78
-
79
-
80
-
81
-
82
-
83
-
84
-
85
- options = {
86
-
87
- uri:'https://api.zoom.us/v2/users/'+{mail}+'/meetings',
88
-
89
- qs:{
90
-
91
- status:'active'
92
-
93
- },
94
-
95
- auth:{
96
-
97
- 'bearer':token
98
-
99
- },
100
-
101
- headers:{
102
-
103
- 'User-Agent':'Zoom-api-Jwt-Request',
104
-
105
- 'content-type':'application/json'
106
-
107
- },
108
-
109
- json:true
110
-
111
- }
112
-
113
- if requests.post(options):
114
-
115
- console.log('User has', response)
116
-
117
- console.log(token)
118
-
119
- console.log(JSON.stringify(resp, null, 2))
120
-
121
- else:
122
-
123
- console.log('API call failed, reason ', err)
124
-
125
-
126
-
127
- return render(request,'/about.html',token)
128
-
129
-
130
-
131
- ```
132
-
133
- ```index.html
134
-
135
- <!doctype html>
136
-
137
- <html lang="ja">
138
-
139
- <head>
140
-
141
- <meta charset="utf-8" />
142
-
143
- <title>api</title>
144
-
145
- </head>
146
-
147
- <body>
148
-
149
- <h1>userID</h1>
150
-
151
- <form acition="{%url 'about'%}"method="get">
152
-
153
- {% csrf_token %}
154
-
155
- <p>userID</p>
156
-
157
- <input type="tel" placeholder="UserID" value="{{ 'mail' }}">
158
-
159
- <input type="submit" value="認証する">
160
-
161
- </form>
162
-
163
- </body>
164
-
165
- </html>
166
-
167
- ```
168
-
169
- ```urls.py
170
-
171
- from django.contrib import admin
172
-
173
- from django.urls import path
174
-
175
- from rest_framework_jwt.views import obtain_jwt_token
176
-
177
- from . import views #�NjL
178
-
179
-
180
-
181
- urlpatterns = [
182
-
183
- path('admin/', admin.site.urls),
184
-
185
- path('',views.index,name='index'),
186
-
187
- path('about/',views.about,name='about')
188
-
189
- #path('jwt-token/', obtain_jwt_token),
190
-
191
- #path('ping', views.PingViewSet.as_view()), # �NjL
192
-
193
- ]
194
-
195
- ```
196
-
197
-
198
-
199
- ### 試したこと
200
-
201
- http://r9.hateblo.jp/entry/2018/01/30/081534
202
-
203
203
 
204
204
 
205
205
 

5

追記

2019/05/16 05:51

投稿

django
django

スコア19

test CHANGED
File without changes
test CHANGED
@@ -54,9 +54,9 @@
54
54
 
55
55
  cosole.log('mail')
56
56
 
57
- ApiKey = 'u7qjQoMGRXGMbSK9g0g-zQ'
57
+ ApiKey = 'zzz'
58
-
58
+
59
- ApiSercret = '2zNNLaNIdDa9G92vLZUl1R0hAK3kCmcRIc2r'
59
+ ApiSercret = 'zzz'
60
60
 
61
61
 
62
62
 

4

追記

2019/05/16 05:43

投稿

django
django

スコア19

test CHANGED
@@ -1 +1 @@
1
- zoom api のtoken作成
1
+ zoom api の使用法
test CHANGED
File without changes

3

一部修正

2019/05/16 05:41

投稿

django
django

スコア19

test CHANGED
File without changes
test CHANGED
@@ -8,15 +8,21 @@
8
8
 
9
9
  なのでまずhtmlからuserIDを入力後対象の会議リストを取得しようとしています。
10
10
 
11
- jwtのtoken作成に生ずまっいました
11
+ 現状、token作成ができて、URL上に出力され
12
+
12
-
13
+ ですが、token作成からどのようにAPIを取得するのかがわかりません。
14
+
15
+ 以下URLではusesのAPIなどを取得できています。
16
+
17
+ http://r9.hateblo.jp/entry/2018/01/30/081534
18
+
13
- tokenの作成はどのように確認していくのでしょうか。
19
+ どのように取得するのでしょうか。
14
20
 
15
21
  ### 該当のソースコード
16
22
 
17
23
 
18
24
 
19
- ```viewspy
25
+ ```views.py
20
26
 
21
27
  from django.shortcuts import render
22
28
 
@@ -32,15 +38,25 @@
32
38
 
33
39
  def index(request):
34
40
 
41
+
42
+
43
+ params={
44
+
45
+ 'mail':'',
46
+
47
+ }
48
+
35
- return render(request,'api/index.html')
49
+ return render(request,'api/index.html',params)
36
50
 
37
51
 
38
52
 
39
53
  def about(request):
40
54
 
41
- ApiKey = 'xxx'
55
+ cosole.log('mail')
42
-
56
+
43
- ApiSercret = 'xxx'
57
+ ApiKey = 'u7qjQoMGRXGMbSK9g0g-zQ'
58
+
59
+ ApiSercret = '2zNNLaNIdDa9G92vLZUl1R0hAK3kCmcRIc2r'
44
60
 
45
61
 
46
62
 
@@ -62,12 +78,6 @@
62
78
 
63
79
 
64
80
 
65
-
66
-
67
-
68
-
69
- mail = request.POST['mail']
70
-
71
81
 
72
82
 
73
83
 
@@ -100,29 +110,27 @@
100
110
 
101
111
  }
102
112
 
103
-
113
+ if requests.post(options):
114
+
104
-
115
+ console.log('User has', response)
116
+
105
-
117
+ console.log(token)
118
+
106
-
119
+ console.log(JSON.stringify(resp, null, 2))
120
+
121
+ else:
122
+
123
+ console.log('API call failed, reason ', err)
124
+
125
+
126
+
107
- return render(request,'api/about.html',token)
127
+ return render(request,'/about.html',token)
108
-
109
-
110
-
111
- #requests.post(options)
128
+
112
-
113
- # try:
129
+
114
-
115
- # break
116
-
117
- # except:
118
-
119
-
120
-
121
-
122
130
 
123
131
  ```
124
132
 
125
- ```index
133
+ ```index.html
126
134
 
127
135
  <!doctype html>
128
136
 
@@ -146,7 +154,7 @@
146
154
 
147
155
  <p>userID</p>
148
156
 
149
- <input type="tel" placeholder="UserID" value="{% 'mail' %}">
157
+ <input type="tel" placeholder="UserID" value="{{ 'mail' }}">
150
158
 
151
159
  <input type="submit" value="認証する">
152
160
 
@@ -158,7 +166,17 @@
158
166
 
159
167
  ```
160
168
 
161
- ```urls
169
+ ```urls.py
170
+
171
+ from django.contrib import admin
172
+
173
+ from django.urls import path
174
+
175
+ from rest_framework_jwt.views import obtain_jwt_token
176
+
177
+ from . import views #�NjL
178
+
179
+
162
180
 
163
181
  urlpatterns = [
164
182
 
@@ -168,7 +186,9 @@
168
186
 
169
187
  path('about/',views.about,name='about')
170
188
 
171
-
189
+ #path('jwt-token/', obtain_jwt_token),
190
+
191
+ #path('ping', views.PingViewSet.as_view()), # �NjL
172
192
 
173
193
  ]
174
194
 
@@ -178,10 +198,6 @@
178
198
 
179
199
  ### 試したこと
180
200
 
181
- こちらのサイトを見ると自分のユーザーIDを入力したらトークンが作成されていますが
182
-
183
- どのようにしてトークンが作成されているか確認できるのでしょうか。
184
-
185
201
  http://r9.hateblo.jp/entry/2018/01/30/081534
186
202
 
187
203
 

2

追記

2019/05/16 05:34

投稿

django
django

スコア19

test CHANGED
File without changes
test CHANGED
@@ -202,6 +202,10 @@
202
202
 
203
203
  https://qiita.com/uasi/items/cfb60588daa18c2ec6f5
204
204
 
205
+ 使用JWT
206
+
207
+ https://github.com/lepture/authlib
208
+
205
209
 
206
210
 
207
211
  フレームワークとapiを使うのが初めてなので

1

追記

2019/05/16 03:58

投稿

django
django

スコア19

test CHANGED
File without changes
test CHANGED
@@ -186,6 +186,14 @@
186
186
 
187
187
 
188
188
 
189
+
190
+
191
+ また以下サイトを参照しトークンの作成は確認できました。
192
+
193
+ https://qiita.com/gaku3601/items/19f734fedd5fe19e5c77
194
+
195
+
196
+
189
197
  ###参照しているサイト
190
198
 
191
199
  https://marketplace.zoom.us/docs/guides/authorization/jwt/authentication