-
Type: Bug
-
Resolution: Fixed
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
-
?
-
6682
-
Not Needed
How frequently does the bug occur?
Always
Description
Hi all,
I'm unable to authenticate the realm user when I'm running my app on an Android Emulator. I keep getting the following errors;
ERROR [Realm.App - error] App: request location failed (CustomError -1): request to https://services.cloud.mongodb.com/api/client/v2.0/app/application-0-xxxxxx/location failed, reason: Network request failed ERROR [Realm.App - error] App: log_in_with_credentials failed: 0 message: request to https://services.cloud.mongodb.com/api/client/v2.0/app/application-0-xxxxxx/location failed, reason: Network request failed
The authentication works when I use a physical device, but fails instantly when I run on an Emulator. I'm using the customJWT auth flow shown below;
const LogInScreen = () => { const {logInWithJWT, result} = useAuth(); //const {logInWithAnonymous, result} = useAuth(); const login = React.useCallback(async () => { try { var tokens = await SignInAzure(); logInWithJWT(tokens["id_token"]); } catch (error) { console.log(error); } }); return ( <View> <Button title="Sign in to realm" onPress={login} /> </View> ); };
LoginScreen is passed to my UserProvider like so;
{{<UserProvider fallback=
{<LogInScreen />}>}}I've tried anonymous auth and email password authentication, both of which fail on emulator but succeed on a physical device.
h3. Stacktrace & log output
ERROR [Realm.App - error] App: request location failed (CustomError -1): request to https://services.cloud.mongodb.com/api/client/v2.0/app/application-0-xxxxxx/location failed, reason: Network request failed ERROR [Realm.App - error] App: log_in_with_credentials failed: 0 message: request to https://services.cloud.mongodb.com/api/client/v2.0/app/application-0-xxxxxx/location failed, reason: Network request failed
h3. Can you reproduce the bug?
Always
h3. Reproduction Steps
React Version 0.73.1
@realm/react
* 0.7.0
realm: 12.9.0
Using a Pixel 5 emulator running platform version 34
<AppProvider id={Config.REALM_APP_ID}>
<UserProvider fallback={<LogInScreen />}
>
<RealmProvider
sync={{
flexible: true,
initialSubscriptions: {
update(subs, realm)
,
},
}}
>
<GestureHandlerRootView>
<NavigationContainer>
<Tabs />
</NavigationContainer>
</GestureHandlerRootView>
</RealmProvider>
</UserProvider>
</AppProvider>
Version
12.9.0
What services are you using?
Atlas Device Sync
Are you using encryption?
Yes
Platform OS and version(s)
Android SDK Version 34 & 33
Build environment
Which debugger for React Native: ..
Cocoapods version
No response