auth0-samples / auth0-ionic2-samples

MIT License
28 stars 56 forks source link

Fixed error in auth.service.ts #13

Closed frizzo closed 7 years ago

chenkie commented 7 years ago

Thanks for your PR :)

This actually needs to be the accessToken instead of the idToken. The getUserInfo method relies on that.

What was the problem the accessToken caused in your case?

saschwarz commented 7 years ago

Without this change the authenticated method does not detect when the user is already logged in if/when the app is restarted: https://github.com/auth0-samples/auth0-ionic2-samples/blob/master/01-Login/src/services/auth/auth.service.ts#L49

The getUserInfo method does rely on this.accessToken but getUserInfo is only called in the authenticated callback and that callback sets accessToken: https://github.com/auth0-samples/auth0-ionic2-samples/blob/master/01-Login/src/services/auth/auth.service.ts#L49

chenkie commented 7 years ago

ah I see what you're saying. yes, that makes sense. thanks for clarifying 👍

frizzo commented 7 years ago

@saschwarz thanks for explaining the issue