Skip to content

Commit d8bdf4d

Browse files
authored
Merge pull request #27 from auth0-samples/alexisluque-patch-1
Update server.py
2 parents e320fb5 + ca148a8 commit d8bdf4d

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

00-Starter-Seed/server.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -129,12 +129,12 @@ def decorated(*args, **kwargs):
129129
raise AuthError({"code": "invalid_header",
130130
"description":
131131
"Unable to parse authentication"
132-
" token."}, 400)
132+
" token."}, 401)
133133

134134
_request_ctx_stack.top.current_user = payload
135135
return f(*args, **kwargs)
136136
raise AuthError({"code": "invalid_header",
137-
"description": "Unable to find appropriate key"}, 400)
137+
"description": "Unable to find appropriate key"}, 401)
138138
return decorated
139139

140140

@@ -144,7 +144,7 @@ def decorated(*args, **kwargs):
144144
def public():
145145
"""No access token required to access this route
146146
"""
147-
response = "All good. You don't need to be authenticated to call this"
147+
response = "Hello from a public endpoint! You don't need to be authenticated to see this."
148148
return jsonify(message=response)
149149

150150

@@ -155,7 +155,7 @@ def public():
155155
def private():
156156
"""A valid access token is required to access this route
157157
"""
158-
response = "All good. You only get this message if you're authenticated"
158+
response = "Hello from a private endpoint! You need to be authenticated to see this."
159159
return jsonify(message=response)
160160

161161

@@ -167,11 +167,11 @@ def private_scoped():
167167
"""A valid access token and an appropriate scope are required to access this route
168168
"""
169169
if requires_scope("read:messages"):
170-
response = "All good. You're authenticated and the access token has the appropriate scope"
170+
response = "Hello from a private endpoint! You need to be authenticated and have a scope of read:messages to see this."
171171
return jsonify(message=response)
172172
raise AuthError({
173-
"code": "Anauthorized",
174-
"desciption": "You don't have access to this resource"
173+
"code": "Unauthorized",
174+
"description": "You don't have access to this resource"
175175
}, 403)
176176

177177

0 commit comments

Comments
 (0)