Coder Social home page Coder Social logo

Comments (10)

matthewkooshad avatar matthewkooshad commented on September 15, 2024

if the app terminates, then the UI is getting presented. so, it seems it's only cached while the app is running in the foreground and background, but once the app is closed, then it will present the UI again for the user to choose the google account to login with. so, this is a 2nd problem.

so, for the first problem, we store on the device's user prefs that the user has a google account used before.

but, for the the 2nd issue stated in this comment, how do i cache the tokens and check for valid without going to the UI again for the user to choose their account again? this is the experience i am seeing when using googleApi.authenticate()

from simple_auth.

Clancey avatar Clancey commented on September 15, 2024

I cannot duplicate this. Using the sample, on iOS and Android if I log into an account. next time I press login the UI is not shown. What platform are you trying this on? iOS Simulator has had a bug for years, if you don't specify entitlements it will not let you securely save tokens. So this could happen on the iOS Simulator.

from simple_auth.

matthewkooshad avatar matthewkooshad commented on September 15, 2024

from simple_auth.

Clancey avatar Clancey commented on September 15, 2024

I have been debugging. Starting and stoping the debugger. That kills the processes

from simple_auth.

Clancey avatar Clancey commented on September 15, 2024

If you look at the authenticate code, it loads the cached account. If it is still valid, it returns and never presents the UI: https://github.com/Clancey/simple_auth/blob/master/simple_auth/lib/src/oauth/oauthApi.dart#L60-L72

from simple_auth.

Clancey avatar Clancey commented on September 15, 2024

I would recommend cloning the source, putting some breakpoints in there and see what happens for you.

from simple_auth.

matthewkooshad avatar matthewkooshad commented on September 15, 2024

from simple_auth.

matthewkooshad avatar matthewkooshad commented on September 15, 2024

@Clancey you're right about that example performing as i'm looking for. i don't know what i'm doing wrong.

from simple_auth.

Clancey avatar Clancey commented on September 15, 2024

What provider are you using? A custom one? If so, it is most likely not setting the RefreshToken or the Expiration on the account.

from simple_auth.

matthewkooshad avatar matthewkooshad commented on September 15, 2024

sorry, i don't understand to answer that. but, i did want to report back in case someone encounters this problem as well. for me, it was a scope issue of where this instance was declared:
final simpleAuth.GoogleApi googleApi = new simpleAuth.GoogleApi(,,,
when i relocated it to the same function where the below statement happens, then it was working as the example, giving the desired result. i think i'm fine with the result of the code on this, so i will not be investigating why for now.
var user = await googleApi.getUserProfile();

from simple_auth.

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.