I guess it depends what your threat model is.
Do you trust the user, but are worried about malware? If so, you can't fully secure the secret. You could encrypt the secret yourself, but the decryption key will need to be stored somewhere. You could use an OS credential manager (e.g. keychain), but the secret will ultimately end up in your process's memory, which can be read by a debugger (or, generally, another app with elevated privileges).
Do you not trust the user, e.g. want to prevent them from accessing the secret? In that case, there's really not a lot you can do.
About the best you can do is use the OS credential manager and sandbox your app (if possible). That will at least make life more difficult.