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

How to get complete AuthResponse object from google signin? Not able to fetch expires_in property from response. #365

Closed
bhorpooja opened this issue Feb 16, 2021 · 5 comments

Comments

@bhorpooja
Copy link

bhorpooja commented Feb 16, 2021

I'm facing problem to get expires_in attribute from this.socialAuthService.signIn() method, it does not exist in response.

Angular Version: 7.0.0

Need to update below highlighted code in GoogleLoginProvider to get all property

angularx-social-login\angularx-social-login.es5.js

File code:
getLoginStatus() and signIn() methods to be update for GoogleLoginProvider

`   /**
     * @return {?}
     */
    GoogleLoginProvider.prototype.getLoginStatus = /**
     * @return {?}
     */
    function () {
        var _this = this;
        return new Promise(function (resolve, reject) {
            _this.onReady().then(function () {
                if (_this.auth2.isSignedIn.get()) {
                    var /** @type {?} */ user = new SocialUser();
                    var /** @type {?} */ profile = _this.auth2.currentUser.get().getBasicProfile();
                    **var /** @type {?} */ authRes = _this.auth2.currentUser.get().getAuthResponse();**
                    var /** @type {?} */ token = _this.auth2.currentUser.get().getAuthResponse(true).access_token;
                    var /** @type {?} */ backendToken = _this.auth2.currentUser.get().getAuthResponse(true).id_token;
                    user.id = profile.getId();
                    user.name = profile.getName();
                    user.email = profile.getEmail();
                    user.photoUrl = profile.getImageUrl();
                    user.firstName = profile.getGivenName();
                    user.lastName = profile.getFamilyName();
                    **user.authResponse = authRes;**
                    user.authToken = token;
                    user.idToken = backendToken;
                    resolve(user);
                }
            });
        });
    };`

Can some please look into this?

@jaibatrik
Copy link
Contributor

Yeah, this needs a fix. Feel free to send a PR. Else, I'll make the change when I get some time.

bhorpooja pushed a commit to bhorpooja/angularx-social-login that referenced this issue Feb 16, 2021
@bhorpooja
Copy link
Author

Hi @jaibatrik,

I have created PR. Can you please look into it

bhorpooja pushed a commit to bhorpooja/angularx-social-login that referenced this issue Feb 16, 2021
jaibatrik added a commit that referenced this issue Feb 18, 2021
Fixed auth response for google login provider #365
@jaibatrik
Copy link
Contributor

Not remembering if I released this fix to npm. @bhorpooja did you receive the fix?

@bhorpooja
Copy link
Author

Not remembering if I released this fix to npm. @bhorpooja did you receive the fix?

@jaibatrik No. I didn't receive any fixes.

@jaibatrik
Copy link
Contributor

Published to npm. Fix should be available at v3.5.5.

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