openmobilehub / react-native-omh-storage

https://openmobilehub.github.io/react-native-omh-storage/
Apache License 2.0
7 stars 0 forks source link

Blocking Issue: Mismatched Redirect URI in RN OMH Auth Sample App #50

Closed dzuluaga closed 2 months ago

dzuluaga commented 2 months ago

I'm encountering a blocking issue when running the RN OMH Auth Sample App. The error message generated is as follows:

The redirect URI in the configuration doesn't match with the one generated with package name and signature hash. Please verify the URI in the config file and your app registration in Azure portal.
We expected msauth://com.openmobilehub.reactnative.storage.sample/y8vS6R4j8fmy... and we received msath://com.openmobilehub.reactnative.storage.sample/eK%2B7....
image

I have thoroughly reviewed the configuration files and the app registration in the Azure portal. The application_id I'm pointing to has the URI eK%2B7... as the redirect URI. However, I am unsure where the URI y8vS6R4j8fmy... is coming from, as it's not present in the configuration files or the app registration in the Azure portal.

At this point, I'm unsure if this is a bug within the SDK or a misconfiguration on my side. Any assistance in resolving this issue would be greatly appreciated.

Steps to Reproduce

You can reproduce the issue by following these steps:

  1. Clone the repository.
  2. Use the local.properties file to set MICROSOFT_CLIENT_ID and MICROSOFT_SIGNATURE_HASH.
  3. Set the same values in the .env file.
  4. Run the app.

Expected Behavior

The app should correctly match the redirect URI as specified in the configuration files and the Azure portal app registration.

Actual Behavior

The redirect URI generated does not match the one specified in the configuration files and the Azure portal, leading to the above-mentioned error.

Additional Information

This error is extremely difficult to troubleshoot, and any developer encountering it may likely drop the SDK due to the frustration involved. It's critical that we address this issue to prevent such occurrences.

Notably, the configurations for Google Drive and Dropbox work without any issues.

adamTrz commented 2 months ago

Hey @dzuluaga, thanks for reporting the issue đź‘Ť I was able to successfully build and run the app by following omh-android app integration guide. Apart from setting Microsoft Client Id and Microsoft Signature Hash you have to create and populate ms_auth_config.json file with MSAL Configuration as described here in points 3 and 4:

https://github.com/openmobilehub/android-omh-storage/blob/main/packages/plugin-onedrive/README.md#console-app

This is the place that ties up redirect Uri and.

So in a nutshell you have to do three things:

Please let me know if that helps! :)

dzuluaga commented 2 months ago

Hi Adam,

Thank you for your suggestion. Unfortunately, that doesn't resolve the issue. The ms_auth_config.json file is actually generated by the app using values from the local.properties file, so I didn’t need to follow the steps you provided.

I think it would be more effective for us to meet and troubleshoot this together. Could you please schedule some time on my calendar for tomorrow at 8:30 AM PST?

Thanks again!

dzuluaga commented 2 months ago

Hey @adamTrz,

I’ve created another bug to capture the root cause. Let’s discuss it more tomorrow, either in the morning or evening—whichever works best for you.

Thanks!

Link to the issue

adamTrz commented 2 months ago

Hey @dzuluaga Could you please make sure that the Package name: com.openmobilehub.reactnative.storage.sample , your MICROSOFT_CLIENT_ID and MICROSOFT_SIGNATURE_HASH are correctly added to the Azure console app?

dzuluaga commented 2 months ago

Hi @adamTrz, as mentioned above, please check:

https://github.com/openmobilehub/react-native-omh-storage/issues/55

The issue is solved by using the hash from the debug.keystore file in the repo, but that could lead to some complications.

Let's discuss today in our call

adamTrz commented 2 months ago

We've removed debug.keystore from source control and implemented on the fly keystore creation from GH Actions This issue should be fixed once https://github.com/openmobilehub/react-native-omh-storage/pull/57 is mergerd.