coalescing_panda 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
@@ -3,17 +3,16 @@ module CoalescingPanda
|
|
3
3
|
|
4
4
|
def canvas_oauth2
|
5
5
|
user_id = params['user_id']
|
6
|
-
api_domain = params['custom_canvas_api_domain']
|
7
6
|
|
8
|
-
if token = CanvasApiAuth.where('user_id = ? and api_domain = ?', user_id,
|
9
|
-
@client = Bearcat::Client.new(token: token, prefix:
|
7
|
+
if token = CanvasApiAuth.where('user_id = ? and api_domain = ?', user_id, request.host).pluck(:api_token).first
|
8
|
+
@client = Bearcat::Client.new(token: token, prefix: request.host)
|
10
9
|
elsif @lti_account = params['oauth_consumer_key'] && LtiAccount.find_by_key(params['oauth_consumer_key'])
|
11
10
|
client_id = @lti_account.oauth2_client_id
|
12
|
-
client = Bearcat::Client.new(prefix:
|
11
|
+
client = Bearcat::Client.new(prefix: request.host)
|
13
12
|
@lti_params = params.to_hash
|
14
13
|
@canvas_url = client.auth_redirect_url(client_id,
|
15
14
|
coalescing_panda.oauth2_redirect_url({key: params['oauth_consumer_key'],
|
16
|
-
user_id: user_id, api_domain:
|
15
|
+
user_id: user_id, api_domain: request.host}))
|
17
16
|
#delete the added params so the original oauth sig still works
|
18
17
|
@lti_params.delete('action')
|
19
18
|
@lti_params.delete('controller')
|