refactor(auth): remove redirect_uri from OAuth flow initiation
Remove redirect_uri parameter from initiate_login_flow, initiate_register_flow, and initiate_link_flow functions.
This commit is contained in:
@@ -18,7 +18,6 @@ logger = logging.getLogger(__name__)
|
|||||||
@api_v1_bp.route("/auth/external/<provider>/authorize", methods=["GET"])
|
@api_v1_bp.route("/auth/external/<provider>/authorize", methods=["GET"])
|
||||||
def initiate_oauth_authorize(provider: str):
|
def initiate_oauth_authorize(provider: str):
|
||||||
flow = request.args.get("flow", "login")
|
flow = request.args.get("flow", "login")
|
||||||
redirect_uri = request.args.get("redirect_uri")
|
|
||||||
organization_id = request.args.get("organization_id")
|
organization_id = request.args.get("organization_id")
|
||||||
oidc_session_id = request.args.get("oidc_session_id")
|
oidc_session_id = request.args.get("oidc_session_id")
|
||||||
|
|
||||||
@@ -29,11 +28,11 @@ def initiate_oauth_authorize(provider: str):
|
|||||||
provider_type = get_provider_type(provider)
|
provider_type = get_provider_type(provider)
|
||||||
if flow == "login":
|
if flow == "login":
|
||||||
auth_url, state = OAuthFlowService.initiate_login_flow(
|
auth_url, state = OAuthFlowService.initiate_login_flow(
|
||||||
provider_type=provider_type, organization_id=organization_id, redirect_uri=redirect_uri,
|
provider_type=provider_type, organization_id=organization_id,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
auth_url, state = OAuthFlowService.initiate_register_flow(
|
auth_url, state = OAuthFlowService.initiate_register_flow(
|
||||||
provider_type=provider_type, organization_id=organization_id, redirect_uri=redirect_uri,
|
provider_type=provider_type, organization_id=organization_id,
|
||||||
)
|
)
|
||||||
|
|
||||||
if oidc_session_id:
|
if oidc_session_id:
|
||||||
|
|||||||
@@ -171,13 +171,11 @@ def initiate_link_account(provider: str):
|
|||||||
|
|
||||||
user_orgs = g.current_user.get_organizations()
|
user_orgs = g.current_user.get_organizations()
|
||||||
organization_id = user_orgs[0].id if user_orgs else None
|
organization_id = user_orgs[0].id if user_orgs else None
|
||||||
data = request.json or {}
|
|
||||||
redirect_uri = data.get("redirect_uri")
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
auth_url, state = ExternalAuthService.initiate_link_flow(
|
auth_url, state = ExternalAuthService.initiate_link_flow(
|
||||||
user_id=g.current_user.id, provider_type=provider_type,
|
user_id=g.current_user.id, provider_type=provider_type,
|
||||||
organization_id=organization_id, redirect_uri=redirect_uri,
|
organization_id=organization_id,
|
||||||
)
|
)
|
||||||
return api_response(data={"authorization_url": auth_url, "state": state}, message="Link flow initiated. Redirect to authorization URL.")
|
return api_response(data={"authorization_url": auth_url, "state": state}, message="Link flow initiated. Redirect to authorization URL.")
|
||||||
except ExternalAuthError as e:
|
except ExternalAuthError as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user