I have a script that enables OTP / Google Auth via SSH keys and OTP on linux systems. Once OTP is enabled I send the user a SMS with an otpauth URL. I need to extract the ( normally 16 digit key ) from the otpauth URL.
If they want a visible QR code, an example of the URL is below:
If they want an otpauth url they can click on to import into a Token / Password Manager, I use the following:
How can I extract the Secret Key from the URL ?