Skip to content

Commit 6f79eca

Browse files
authored
Merge pull request #53 from PengfeiLi0218/master
gets a `Server Error: 500` When accessing the API Tester page and rename Settings OAUTH_BASE_URL --> REDIRECT_URL
2 parents 0de1b0d + 1f9ec9e commit 6f79eca

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ DATABASES = {
127127
}
128128
}
129129
#API Tester URL
130-
OAUTH_BASE_URL='http://127.0.0.1:8000'
130+
REDIRECT_URL='http://127.0.0.1:8000'
131131

132132
```
133133

apitester/apitester/settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@
190190
API_BASE_PATH = '/obp/v'
191191
API_VERSION = '3.0.0'
192192

193-
OAUTH_BASE_URL='http://127.0.0.1:9090'
193+
REDIRECT_URL='http://127.0.0.1:9090'
194194

195195
# Always save session
196196
SESSION_SAVE_EVERY_REQUEST = True
@@ -213,4 +213,4 @@
213213
# Settings here might use parts overwritten in local settings
214214
API_ROOT = API_HOST + API_BASE_PATH + API_VERSION
215215

216-
#OAUTH_BASE_URL='https://apisandbox.openbankproject.com'
216+
#REDIRECT_URL='https://apisandbox.openbankproject.com'

apitester/apitester/urls.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
LOGGER = logging.getLogger(__name__)
1616

1717
def LogAtStart():
18-
LOGGER.log(logging.INFO, 'OAUTH_BASE_URL: {}'.format(
19-
settings.OAUTH_BASE_URL))
18+
LOGGER.log(logging.INFO, 'REDIRECT_URL: {}'.format(
19+
settings.REDIRECT_URL))
2020

2121
LOGGER.log(logging.INFO, 'API_HOST: {}'.format(
2222
settings.API_HOST))

apitester/base/context_processors.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ def api_username(request):
2121
try:
2222
api = API(request.session.get('obp'))
2323
data = api.get('/users/current')
24-
username = data['username']
24+
if 'username' in data:
25+
username = data['username']
2526
except APIError as err:
2627
messages.error(request, err)
2728
return {'API_USERNAME': username}

apitester/obp/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def get_callback_uri(self, request):
5252
initiation at OAuth server
5353
"""
5454
#base_url = '{}://{}'.format(request.scheme, request.environ['HTTP_HOST'])
55-
base_url = settings.OAUTH_BASE_URL
55+
base_url = settings.REDIRECT_URL
5656
uri = base_url + reverse('oauth-authorize')
5757
if 'next' in request.GET:
5858
uri = '{}?next={}'.format(uri, request.GET['next'])

0 commit comments

Comments
 (0)