openmobilehub / react-native-omh-auth

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

Clarify JSON Definition to Indicate `ios` Section Applies to Both iOS and Android #61

Closed dzuluaga closed 1 month ago

dzuluaga commented 1 month ago

The following JSON definition tags ios. However, I was able to fix the issue in Android by modifying this section. Clearly, this section also applies to the Android app configuration. Would it be possible to modify the attribute name to make it clear that the ios section applies to both platforms?

Here is the current configuration:

await DropboxAuth.initialize({
  android: {
    scopes: ['account_info.read', 'sharing.read'],
  },
  ios: {
    scopes: ['account_info.read', 'sharing.read'],
    clientId: DROPBOX_CLIENT_ID,
    clientSecret: DROPBOX_CLIENT_SECRET,
    redirectUrl: 'com.omh.auth.sample://oauth',
  },
});

Proposed Change:

Modify the attribute name to indicate that it applies to both iOS and Android, ensuring clarity in the configuration. For instance:

await DropboxAuth.initialize({
  android: {
    scopes: ['account_info.read', 'sharing.read'],
  },
  shared: {  // Change 'ios' to 'shared' or a similar term that indicates applicability to both platforms
    scopes: ['account_info.read', 'sharing.read'],
    clientId: DROPBOX_CLIENT_ID,
    clientSecret: DROPBOX_CLIENT_SECRET,
    redirectUrl: 'com.omh.auth.sample://oauth',
  },
});

Thank you!

Esemesek commented 1 month ago

Hey @dzuluaga, ios part of the config is used only for the iOS platform and the same goes for Android. This is a design decision as some of the common keys between platforms will have different values based on the platform. You must have done something else to fix your problem, here is the implementation reference:

Android code: https://github.com/openmobilehub/react-native-omh-auth/blob/main/packages/core/src/AndroidAuthModule.ts#L30 iOS code: https://github.com/openmobilehub/react-native-omh-auth/blob/main/packages/core/src/IOSAuthModule.ts#L39

dzuluaga commented 1 month ago

Thanks, @Esemesek. Strange. It's working okay using process.env. Will keep it monitored.

andrei-zgirvaci commented 1 month ago

Hey @dzuluaga, there was bug that required the user to have the provider secrets stored in the process.env. It was fixed in https://github.com/openmobilehub/react-native-omh-auth/commit/c65886ae6b328ca0a380b38b3128368f9818dd07. Maybe it caused the issue you were facing...

dzuluaga commented 1 month ago

Thanks, @andrei-zgirvaci for the heads. Will try it again later this week.