Google-signin: Sigin with google after some days throwing error in both ios and android

Created on 15 Nov 2018  路  5Comments  路  Source: react-native-google-signin/google-signin

Hi, I have integrated google to my react native project. it worked super fine and i can able to get data form google. I didnt any code and now trying after a week to sign in with google throwing error message as
RNGoogleSignInError: Unknown error when signing in., Error Domain=com.google.HTTPStatus Code=400 "(null)" UserInfo={json={
error = "invalid_audience";
"error_description" = "The audience client and the client need to be in the same project.";
}, data=<7b0a2020 22657272 6f72223a 2022696e 76616c69 645f6175 6469656e 6365222c 0a202022 6572726f 725f6465 73637269 7074696f 6e223a20 22546865 20617564 69656e63 6520636c 69656e74 20616e64 20746865 20636c69 656e7420 6e656564 20746f20 62652069 6e207468 65207361 6d652070 726f6a65 63742e22 0a7d>}

the code that i written is GoogleSignin.signIn().then((user) => {
console.log("email is: n" + user.user)
this.props.googleSignInDetails(user.user)
this.setState({
googleName: user.user.name,
googleMail: user.user.email,
providerName: "google",
isSocialRegister: "google",
providerId: user.user.id,
}, () => this.socialLogin(this.state.providerId, this.state.providerName))
}).catch((err) => {
console.log('WRONG SIGNIN', err);
Alert.alert("error", err)
this.refs.loading.close()
}).done();

before a week its working fine with the same code now its not I cant able to find what is the root cause for this error message

Most helpful comment

I got this finally, actually what we need to give webcliend client id based on specific platform. IosClientId will be the client id from info.plist and webclientid for ios will be the client id from info.plist and for android client id from .json file
so We can write code something like GoogleSignin.hasPlayServices({autoResolve: true});
GoogleSignin.configure({
iosClientId: 'IOS Client Id',
webClientId: Platform.OS === 'ios' ? 'IOS Client Id' : 'Client Id From Google services.json'
}),
This done the trick for me.
Hope this helps

All 5 comments

Hi there,

The audience client and the client need to be in the same project.

This most likely indicates that the iOS client ID (iosClientId _or_ configured via a plist in Xcode) and the web client ID (webClientId) are tied to different Google projects. Have you changed either of those IDs recently?

No, I didn't changed any, As I said I didn't change any code from past week regarding this google sign in. I have tried many google searches but that wouldnt help me so finally i posted the issue here

I'm having a similar issue, it happened to me yesterday as well.

I got this finally, actually what we need to give webcliend client id based on specific platform. IosClientId will be the client id from info.plist and webclientid for ios will be the client id from info.plist and for android client id from .json file
so We can write code something like GoogleSignin.hasPlayServices({autoResolve: true});
GoogleSignin.configure({
iosClientId: 'IOS Client Id',
webClientId: Platform.OS === 'ios' ? 'IOS Client Id' : 'Client Id From Google services.json'
}),
This done the trick for me.
Hope this helps

I got this finally, actually what we need to give webcliend client id based on specific platform. IosClientId will be the client id from info.plist and webclientid for ios will be the client id from info.plist and for android client id from .json file
so We can write code something like GoogleSignin.hasPlayServices({autoResolve: true});
GoogleSignin.configure({
iosClientId: 'IOS Client Id',
webClientId: Platform.OS === 'ios' ? 'IOS Client Id' : 'Client Id From Google services.json'
}),
This done the trick for me.
Hope this helps

your trick work for me...! thanks

Was this page helpful?
0 / 5 - 0 ratings