diff --git a/app/controllers/auth/ios_controller.rb b/app/controllers/auth/ios_controller.rb index a3df4f5a..d03a0e2f 100644 --- a/app/controllers/auth/ios_controller.rb +++ b/app/controllers/auth/ios_controller.rb @@ -3,12 +3,19 @@ module Auth class IosController < ApplicationController def success - render json: { - success: true, - message: 'iOS authentication successful', - token: params[:token], - redirect_url: root_url - }, status: :ok + # If token is provided, this is the final callback for ASWebAuthenticationSession + if params[:token].present? + # ASWebAuthenticationSession will capture this URL and extract the token + render plain: "Authentication successful! You can close this window.", status: :ok + else + # This should not happen with our current flow, but keeping for safety + render json: { + success: true, + message: 'iOS authentication successful', + redirect_url: root_url + }, status: :ok + end end + end end \ No newline at end of file