I’m trying to integrate google sign in with realm.io.
What I’m doing is:
- Scaffold new Ionic application.
- Create new credentials inside google developer console (client ID).
- Install
@codetrix-studio/capacitor-google-authcomplete the setup part for setting upclient Idwhere its needed. This will retrieve google user object. For web, you want to initialize theGoogleAuth. For android, you will have to take additional setup with sha key. - Install
realm-weband insidemain.tsinitialize realm app usingnew Realm.App({ id: appId }). - Setup code and run it.
This is my end code:
const signInWithGoogle = async () => {
const response = await GoogleAuth.signIn();
const { idToken } = response.authentication;
const credentials = Realm.Credentials.google({ idToken });
realm.logIn(credentials)
.then((user) => {
console.log(`Logged in with id: ${user.id}`);
});
};
For now, this doesn’t work regarding realm.io side as I’m getting HTTP 401 response from realm.io.
I do understand that this is not ionic related issue.
- Has anyone integrated realm.io mongo google login flow?
- If yes, how did you manage to accomplish the required flow to work?
- Maybe there is other options like using firebase authentication with realm.io data storage?
Any help would be appreciated. ![]()