I am building an app which connects to a backend. The backend is protected with some credentials that the app has to send during the first launch, in order to retrieve an auth token and a refresh token (even if the user never authenticates). Those machine credentials are unique per client (one for the Android app and one for the iOS app). Moreover, they are sent in the headers of the request through HTTPS.
What I am currently doing is hard-code these machine credentials (ID and secret) inside the android app code.
Now, on iOS, the app is shipped as binary, so it is very difficult to reverse engineer and retrieve the hard-coded credentials.
On the other hand, the Android app is shipped in dex code, which can be reverse-engineered easily. In this way, even with Proguard enabled, anyone can read these machine credentials from the code.
I am not an expert in security, but is there any way to avoid this? Or is this approach wrong?