Skip to content

Commit 8c72be6

Browse files
committed
Add in skip auth for grabbing api_keys
1 parent e77f09f commit 8c72be6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

auth-api/src/auth_api/services/api_gateway.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def create_key(cls, org_id: int, request_json: Dict[str, str]):
6565
cls._create_consumer(name, org, env=env)
6666
org.has_api_access = True
6767
org.save()
68-
response = cls.get_api_keys(org_id)
68+
response = cls.get_api_keys(org_id, skip_auth=True)
6969
else:
7070
# Create additional API Key if a consumer exists
7171
api_key_response = RestService.post(
@@ -157,10 +157,11 @@ def revoke_key(cls, org_id: int, api_key: str):
157157
)
158158

159159
@classmethod
160-
def get_api_keys(cls, org_id: int) -> List[Dict[str, any]]:
160+
def get_api_keys(cls, org_id: int, skip_auth=False) -> List[Dict[str, any]]:
161161
"""Get all api keys."""
162162
logger.debug("<get_api_keys ")
163-
check_auth(one_of_roles=(ADMIN, STAFF), org_id=org_id)
163+
if skip_auth is False:
164+
check_auth(one_of_roles=(ADMIN, STAFF), org_id=org_id)
164165
api_keys_response = {"consumer": {"consumerKey": []}}
165166
env = current_app.config.get("ENVIRONMENT_NAME")
166167
email = cls._get_email_id(org_id, env)

0 commit comments

Comments
 (0)