Hi there, I hope that someone can help me with the following issue which I’ve been struggling with for a while.
I am trying to use expo-auth-session/providers/google for Google Auth on Android in Expo SDK 39.
I have followed the guide here but everything I do ends up with a google message:
Error 400: invalid_request
Invalid parameter value for redirect_uri: Invalid scheme: com.my_domain.myapp:/oauthredirect
And I just can not understand what am I doing wrong.
I need to mention the fact that the login in the Expo Client works perfectly with the exact same code.
I checked the credentials an infinite amount of times and what bothers me is that it works in the expo client but not on the standalone app so I am sure it’s something related to the google config but I don’t know what.
Here is my app.json:
{
"expo": {
...
"scheme": "myapp",
"platforms": [
"ios",
"android"
],
...
"android": {
"package": "com.my_domain.myapp",
...
}
}
}
And my integration:
import React, { useState } from 'react';
import * as WebBrowser from "expo-web-browser";
import * as Google from 'expo-auth-session/providers/google';
import PillButton from '../UI/PillButton';
const SignupCmp = props => {
const [browserOpen, setBrowserOpen] = useState(null);
const [request, response, promptAsync] = Google.useAuthRequest({
expoClientId: '123-myuniqueid.apps.googleusercontent.com',
androidClientId: '123-myuniqueid.apps.googleusercontent.com'
});
useEffect(() => {
WebBrowser.warmUpAsync().then(r => console.log('warmed'));
return () => {
WebBrowser.coolDownAsync().then(r => console.log('cooled'));
};
}, []);
useEffect(() => {
if (response?.type === 'success') {
const { authentication } = response;
// console.log(authentication);
}
}, [response]);
const handleBrowserOpen = async (url) => {
let result = await WebBrowser.openBrowserAsync(url );
setBrowserOpen(result);
}
return (
<View>
<PillButton
disabled={!request}
title={I18n.t('authScreens.signupWithGoogle')}
type="solid"
onPress={() => { promptAsync().then(async val => {
props.googleAuth(val.authentication.accessToken);
}) }}
/>
</View>
);
};
export default SignupCmp;
I really need help on this one since I am out of ideas.