This is as simple as curl -X POST https://wifi.sncf/router/api/connection/activate/auto
.
No need to give your ticket number.
Not using a Unix-like OS (say, on mobile)? Just head over to the "chatbot" at https://wifi.sncf/fr/internet/bot and accept the EULA (French: CGU) and tell the bot that you have a foreign ticket.