Skip to content

Commit fdf9f07

Browse files
authored
Merge pull request #524 from hackforla/Cognito-redirect-URLs-configurable
Cognito redirect ur ls configurable
2 parents 9070658 + 49b1594 commit fdf9f07

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

api/.env.example

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ COGNITO_REDIRECT_URI=http://localhost:4040/signin
55
COGNITO_USER_POOL_ID=
66
SECRET_KEY=
77
COGNITO_ACCESS_ID=
8-
COGNITO_ACCESS_KEY=
8+
COGNITO_ACCESS_KEY=
9+
ROOT_URL=http://localhost:4040

api/openapi_server/controllers/auth_controller.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
COGNITO_ACCESS_ID = env.get('COGNITO_ACCESS_ID')
3030
COGNITO_ACCESS_KEY = env.get('COGNITO_ACCESS_KEY')
3131
SECRET_KEY=env.get('SECRET_KEY')
32+
ROOT_URL=env.get('ROOT_URL')
3233
cognito_client_url = 'https://homeuniteus.auth.us-east-1.amazoncognito.com'
3334

3435

@@ -154,7 +155,7 @@ def signin():
154155
if(response.get('ChallengeName') and response['ChallengeName'] == 'NEW_PASSWORD_REQUIRED'):
155156
userId = response['ChallengeParameters']['USER_ID_FOR_SRP']
156157
sessionId = response['Session']
157-
return redirect(f"http://localhost:4040/create-password?userId={userId}&sessionId={sessionId}")
158+
return redirect(f"{ROOT_URL}/create-password?userId={userId}&sessionId={sessionId}")
158159

159160
access_token = response['AuthenticationResult']['AccessToken']
160161
refresh_token = response['AuthenticationResult']['RefreshToken']
@@ -423,9 +424,9 @@ def confirm_signup():
423424
ConfirmationCode=code
424425
)
425426

426-
return redirect("http://localhost:4040/email-verification-success")
427+
return redirect(f"{ROOT_URL}/email-verification-success")
427428
except Exception as e:
428-
return redirect("http://localhost:4040/email-verification-error")
429+
return redirect(f"{ROOT_URL}/email-verification-error")
429430

430431
# What comes first invite or adding the user
431432
#Do I have an oauth token

0 commit comments

Comments
 (0)