Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 27a2e7f

Browse files
authored
Merge pull request auth0#18 from rdowinton/logout-fixes
Fixes to logout feature and tests
2 parents d7b4a92 + 7b0c7b1 commit 27a2e7f

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,7 @@ coverage.xml
4646

4747
# Sphinx documentation
4848
docs/_build/
49+
50+
# IDEA
51+
.idea/
52+
*.iml

auth0/v3/authentication/logout.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from .base import AuthenticationBase
2+
from urllib.parse import quote_plus
23

34

45
class Logout(AuthenticationBase):
@@ -26,12 +27,14 @@ def logout(self, client_id, return_to, federated=False):
2627
2728
federated (bool): Querystring parameter to log the user out of the IdP
2829
"""
30+
return_to = quote_plus(return_to)
31+
2932
if federated is True:
3033
return self.get(
31-
'https://%s/v2/logout?federated&%s&%s' % (self.domain, client_id, return_to),
34+
'https://%s/v2/logout?federated&client_id=%s&returnTo=%s' % (self.domain, client_id, return_to),
3235
headers={'Content-Type': 'application/json'}
3336
)
3437
return self.get(
35-
'https://%s/v2/logout?%s&%s' % (self.domain, client_id, return_to),
38+
'https://%s/v2/logout?client_id=%s&returnTo=%s' % (self.domain, client_id, return_to),
3639
headers={'Content-Type': 'application/json'}
3740
)

auth0/v3/test/authentication/test_logout.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def test_logout(self, mock_get):
1515

1616
args, kwargs = mock_get.call_args
1717

18-
self.assertEqual(args[0], 'https://my.domain.com/v2/logout&cid&rto')
18+
self.assertEqual(args[0], 'https://my.domain.com/v2/logout?cid&rto')
1919
self.assertEqual(kwargs['headers'], {
2020
'Content-Type': 'application/json'
2121
})
@@ -31,7 +31,7 @@ def test_federated_logout(self, mock_get):
3131

3232
args, kwargs = mock_get.call_args
3333

34-
self.assertEqual(args[0], 'https://my.domain.com/v2/logout?federated&cid%rto')
34+
self.assertEqual(args[0], 'https://my.domain.com/v2/logout?federated&cid&rto')
3535
self.assertEqual(kwargs['headers'], {
3636
'Content-Type': 'application/json'
3737
})

0 commit comments

Comments
 (0)