This repository was archived by the owner on Jan 24, 2024. It is now read-only.
Refactor cognitoData to dedicated user/session objects#773
Open
Refactor cognitoData to dedicated user/session objects#773
cognitoData to dedicated user/session objects#773Conversation
cognitoData to dedicated user/session objectscognitoData to dedicated user/session objects
68b1bdb to
6dc5b8e
Compare
This splits the functionality/methods up a bit more. BREAKING CHANGE: Moves method definitions/locations around a bit.
6dc5b8e to
d539558
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This splits the functionality/methods up a bit more.
This is a BREAKING CHANGE as it moves the methods around quite a bit. However, migration should be pretty mechanical, doable with search-and-replace:
Changed method locations:
cognito.restoreAndLoad()remains the same;cognito.authenticate()remains the same;cognito.authenticateUser()-->cognito.unauthenticated.verifyUserAuthentication()cognito.logout()--> remains the samecognito.invalidateAccessTokens()--> remains the samecognito.triggerResetPasswordMail()-->cognito.unauthenticated.triggerResetPasswordMail()cognito.updateResetPassword()-->cognito.unauthenticated.updateResetPassword()cognito.setNewPassword()-->cognito.unauthenticated.setInitialPassword()cognito.updatePassword()-->cognito.user.updatePassword()cognito.updateAttributes()-->cognito.user.updateAttributes()cognito.cognitoData.mfa-->cognito.user.mfacognito.cognitoData.cognitoUser-->cognito.user.cognitoUsercognito.cognitoData.cognitoUserSession-->cognito.session.cognitoUserSessioncognito.cognitoData.jwtToken-->cognito.session.jwtTokencognito.cognitoData.userAttributes-->cognito.user.userAttributescognito.cognitoData.getAccessToken()-->cognito.session.getAccessToken()cognito.cognitoData.getIdToken()-->cognito.session.getIdToken()cognito.refreshAccessToken()-->cognito.session.refresh()cognitoDatais no moreAs you can see in the above section,
cognito.cognitoDatahas been replaced withcognito.userandcognito.session.These two properties will be set when the user is authenticated, else they will be
undefined. WhenisAuthenticated === trueyou can assume they are set.In contrast,
unauthenticatedis always available.Change token auto-refresh
In 4.x, JWT tokens will not be automatically refreshed when they expire.
Instead, you can call
cognito.session.enableAutoRefresh()andcognito.session.disableAutoRefresh()to start/stop the auto-refresh background job.There are also some new/changed methods to work with token refreshing:
Other changes/news
This also drops the ember-concurrency dependency.