Currently, the way we are processing the URL string for login.gov is we are doing a simple string search & replace for NONCE and STATE to the values they are supposed to be. This is simple enough, but can have some hidden gotchas, as we discovered in https://github.com/GSA/notifications-admin/pull/2093 as such, I recommend we set the environment variable(s) we are using to be Python format strings, with curly braces, and then use the str.format() method on them to stick the values in. This would be cleaner, more Pythonic, and more precise, and would avoid the problem we encountered with the staging environment's env var.
This would mean the following has to be done:
[ ] Change the environment variables to be format strings. Replacing NONCE with {nonce} and STATE with {state}
[ ] Update the relevant code where this is used to use the URL's .format() method and stick the values in through there i.e. url.format(nonce=nonce, state=state).
[ ] Verify everything now works correctly locally.
[ ] Check if this is necessary for api.
[ ] Entire team needs to update their .env files to reflect this change.
Currently, the way we are processing the URL string for login.gov is we are doing a simple string search & replace for NONCE and STATE to the values they are supposed to be. This is simple enough, but can have some hidden gotchas, as we discovered in https://github.com/GSA/notifications-admin/pull/2093 as such, I recommend we set the environment variable(s) we are using to be Python format strings, with curly braces, and then use the str.format() method on them to stick the values in. This would be cleaner, more Pythonic, and more precise, and would avoid the problem we encountered with the staging environment's env var.
This would mean the following has to be done:
NONCE
with{nonce}
andSTATE
with{state}
.format()
method and stick the values in through there i.e.url.format(nonce=nonce, state=state)
..env
files to reflect this change.