You soft reset.
Step 1. Stand in front of the legendary, but don't interact with it.
Step 2. Save the game.
Step 3. Interact with the legendary. If it is shiny, catch it. If it is not shiny, go on to Step 4.
Step 4. Turn off the game without saving.
Step 5. Turn your game back on, and repeat Step 3.
It will take a loooong time for the legendary to be shiny. It's all based on chance/luck.