Skip to content

Commit c486d03

Browse files
committed
make oauth "remember me" work when logging in on a different shard
fixes CNVS-10966 test plan: 1. create a user 2. add the user to another shard 3. log in to that shard (domain) via oauth (using an app that uses canvas for identity, i.e. scopes=/auth/userinfo) 4. check the "Remember my authorization" box 5. log out 6. log in again 7. you should not get prompted to reauthorize the app Change-Id: I6045bbbf69dab46010232d96e09cf284918f14b4 Reviewed-on: https://gerrit.instructure.com/29625 Reviewed-by: Dan Dorman <ddorman@instructure.com> Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Cody Cutrer <cody@instructure.com> Product-Review: Marc LeGendre <marc@instructure.com> QA-Review: Marc LeGendre <marc@instructure.com>
1 parent 6136483 commit c486d03

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

lib/canvas/oauth/token.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,10 @@ def as_json(options={})
6565
end
6666

6767
def self.find_userinfo_access_token(user, developer_key, scopes, purpose)
68-
user.access_tokens.active.where(:remember_access => true, :developer_key_id => developer_key, :purpose => purpose).detect do |token|
69-
token.scoped_to?(scopes) && token.scoped_to?(['userinfo'])
68+
user.shard.activate do
69+
user.access_tokens.active.where(:remember_access => true, :developer_key_id => developer_key, :purpose => purpose).detect do |token|
70+
token.scoped_to?(scopes) && token.scoped_to?(['userinfo'])
71+
end
7072
end
7173
end
7274

0 commit comments

Comments
 (0)