Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Already Logged in #66

Open
ScriptiZer opened this issue Feb 27, 2018 · 1 comment
Open

Already Logged in #66

ScriptiZer opened this issue Feb 27, 2018 · 1 comment

Comments

@ScriptiZer
Copy link

if you are already logged into facebook using device browser of facebook application
my application asks me to log in

i think it should use my existing token

@lumayara
Copy link

Hi @ScriptiZer .. What I did in my app was to verify if the token is still valid, if it was then I would go to my main screen, if not I would refresh the token or ask for a new login.. Something like this:

if (tnsOAuthModule.instance.tokenResult) {
            console.log('Accesss token expires at: ' + tnsOAuthModule.instance.tokenResult.accessTokenExpiration);
            if (tnsOAuthModule.accessTokenExpired() === true) {
                tnsOAuthModule.instance.refreshToken()
                .then((result: string) => {
                    console.log('SUCCESSFULLY REFRESHED TOKEN!');
                    console.log(result);
                    this.login();
                    
                })
                .catch((er) => {
                    console.log(er);
                    this.ensureToken();
                });
            } else{
                this.login();
            } 
        }
        else{
            this.ensureToken();
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants