Giter VIP home page Giter VIP logo

Comments (6)

joonhocho avatar joonhocho commented on May 28, 2024

@tareq0065 This warning means you are not handling your promise errors. Are you sure you are providing error handler to all your promises?

Make sure to either use catch or provide two functions to then for all promises.

from react-native-google-sign-in.

pitakill avatar pitakill commented on May 28, 2024

@tareq0065 you can do something like:

...
try {
  await GoogleSignIn.configure({
    clientID: '531870286570-28gcrs4oin53rb0aoc8igkutfo2gfijr.apps.googleusercontent.com',
    scopes: [
      'https://www.googleapis.com/auth/drive',
      'https://www.googleapis.com/auth/drive.appdata',
      'https://www.googleapis.com/auth/drive.file',
      'https://www.googleapis.com/auth/drive.metadata',
      'https://www.googleapis.com/auth/drive.metadata.readonly',
      'https://www.googleapis.com/auth/drive.photos.readonly',
      'openid', 'email', 'profile'
    ],
    offlineAccess: true,
    forceCodeForRefreshToken: false
  });
  const user = await GoogleSignIn.signInPromise();
  setTimeout(() => {
    alert(JSON.stringify(user));
  }, 2000);
} catch (error) {
// At least this, but a better handler of the error is better
console.log(error); 
}
...

With the ExampleApp the console.log with the try catch shows:

{code:10, error: "DEVELOPER_ERROR"}

This seems to be the lack of a SHA1 in the Firebase Console from my app.

from react-native-google-sign-in.

trinadhkoya avatar trinadhkoya commented on May 28, 2024

Same Probelm Here also

from react-native-google-sign-in.

MikePodgorniy avatar MikePodgorniy commented on May 28, 2024

https://github.com/devfd/react-native-google-signin/blob/master/android-guide.md#e-getting-developer_error-error-message-on-android-when-trying-to-login

from react-native-google-sign-in.

salujaharkirat avatar salujaharkirat commented on May 28, 2024

Even I was facing this issue. You can try something like this


const authorizeWithPermissions = () => {
  const iosClientId = Config.IOS_GOOGLE_CLIENT_ID;
  const androidClientId = Config.ANDROID_GOOGLE_CLIENT_ID;
  const serverClientID = Config.GOOGLE_SERVER_ID;
  let googleSignConfiguration = {
    scopes: ["email", "https://www.googleapis.com/auth/plus.me", "profile", "https://www.googleapis.com/auth/gmail.readonly"],
    clientID: iosClientId,
    serverClientID
  };
  
  if (Platform.OS === "android") {
    googleSignConfiguration = Object.assign({}, googleSignConfiguration, {
      clientID: androidClientId,
      offlineAccess: true
    });
  }
  
  return GoogleSignIn.configure(googleSignConfiguration)
  .then(() => {
    GoogleSignIn.signOut();
    return GoogleSignIn.signInPromise();
  })
  .then((user) => {
    user.ok = true;
    return user;
  })
  .catch(() => {
    const user = {};
    user.ok = false;
    return user;
  });
};
  registerGoogle = () => {
    this.toggleLoader();
    authorizeWithPermissions()
      .then((response) => {
        const {idToken, serverAuthCode, ok} = response;
        if (!ok) {
          this.toggleLoader();
          return;
        }
      .......

      });
  };

from react-native-google-sign-in.

ziad784 avatar ziad784 commented on May 28, 2024

try use try and catch

from react-native-google-sign-in.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.