diff --git a/geomagio/api/secure/login.py b/geomagio/api/secure/login.py
index d3e7b337fb6bbb7b13de23776f49617d61523322..ecd0c7ab85416b730900f8023213de8ca76b4a16 100644
--- a/geomagio/api/secure/login.py
+++ b/geomagio/api/secure/login.py
@@ -186,7 +186,7 @@ async def authorize(request: Request):
     description="Redirect to OpenID provider.",
 )
 async def login(request: Request):
-    redirect_uri = request.url_for("authorize")
+    redirect_uri = str(request.url_for("authorize"))
     if "127.0.0.1" not in redirect_uri:
         # 127.0.0.1 used for local dev, all others use https
         redirect_uri = redirect_uri.replace("http://", "https://")