Code Monkey home page Code Monkey logo

Comments (15)

devfd avatar devfd commented on May 23, 2024

upon successful login you should automatically get your user object each time you open the app. that's how silent login is supposed to work.

what do you mean when you say not working ? can you share some of your code ?

from google-signin.

spencercarli avatar spencercarli commented on May 23, 2024

Thanks for getting back so quickly! My current code is:

// Configure Google
GoogleSignin.configure({
  iosClientId: config.google.client_id,
  scopes: config.google.scopes,
  // webClientId: config.google.webClientId,
  // offlineAccess: true
});

GoogleSignin.currentUserAsync().then((user) => {
  console.log('USER', user);
}).done();

The problem I'm seeing is that user is null even though the user is authenticated and should be silently logged in.

This worked in my app prior to 0.4.0 when I was listening for the googleSignIn event.

from google-signin.

spencercarli avatar spencercarli commented on May 23, 2024

Something that may be of interest is that when I wrap the currentUserAsync call in a setTimeout like so:

setTimeout(() => {
  GoogleSignin.currentUserAsync().then((user) => {
    console.log('USER', user);
  }).done();
}, 3000);

I'll get the user object returned about 50% of the time

from google-signin.

spencercarli avatar spencercarli commented on May 23, 2024

I just realized this issue can be seen in the example ios app included in this repo.

from google-signin.

devfd avatar devfd commented on May 23, 2024

which is strange. I just started the example app multiple times and I get my user every time with silent signin

from google-signin.

spencercarli avatar spencercarli commented on May 23, 2024

That's really strange. If it's of any help here's a screen recording of what I'm running into.

https://www.dropbox.com/s/9aftno3m42g4xfs/google-sign-in-issue.mov?dl=0

from google-signin.

devfd avatar devfd commented on May 23, 2024

thanks for the screencast, very helpful.

If you restart your application (CMD + R in xcode) and not just reload it, you will see that the silent signin is properly working. but I don't get why user is null when your reload the app. I'll investigate.

you say it was working fine with version 0.3.x ?

from google-signin.

spencercarli avatar spencercarli commented on May 23, 2024

Yes it was working in 0.3.x.

One thing I noticed (again, I don't really know objective c) is that this line https://github.com/apptailor/react-native-google-signin/blob/master/RNGoogleSignin/RNGoogleSignin.m#L28 was previously being called when you would call GoogleSignin.configure but now it's not being called until the currentUserAsync function.

from google-signin.

devfd avatar devfd commented on May 23, 2024

I made some kind of fix / hack :

from xcode, replace the content of RNGoogleSignin.m with this gist https://gist.github.com/devfd/4a544346f4a16f4043ce

I will see if I can find something better before merging with master

from google-signin.

devfd avatar devfd commented on May 23, 2024

the issue with signInSilently is that I get an error from the google sdk right after I reload the app even if placed inside configure method. it is like if the user has been erased while reloading.

from google-signin.

devfd avatar devfd commented on May 23, 2024

it was a simple fix after all. the issue was with how the signin scopes were setup.

all good and well in v0.4.1

to update correctly don't forget to restart react-native packager et rebuild ios project

from google-signin.

spencercarli avatar spencercarli commented on May 23, 2024

Thanks for your prompt action, @devfd! Sadly it seems the issue still persists - but it is better!

The silent login isn't working when the app is reloaded (via CMD + R) but it does correctly sign in when the app is rebuilt.

Let me know if there is any more details or other ways I can help sort this out. I greatly appreciate your time for looking into this!

from google-signin.

spencercarli avatar spencercarli commented on May 23, 2024

Also, it seems that v0.4.1 didn't make it onto npm (I just made the changes manually)

from google-signin.

spencercarli avatar spencercarli commented on May 23, 2024

I went through a fresh installation of v0.4.1 this morning and realized that while testing I was changing the wrong thing. I went through a fresh installation of react-native-google-signin (including taking the steps outlined in the ios guide again) and everything seems to be working correctly again!

Thank you very much for your help @devfd!

from google-signin.

devfd avatar devfd commented on May 23, 2024

great ! let me know if you still have some troubles using the lib

from google-signin.

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.