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

No upgrade path for custom auth.storage configuration #13740

Closed
3 tasks done
jfloodnet opened this issue Aug 21, 2024 · 5 comments
Closed
3 tasks done

No upgrade path for custom auth.storage configuration #13740

jfloodnet opened this issue Aug 21, 2024 · 5 comments
Assignees
Labels
Auth Related to Auth components/category documentation Related to documentation feature requests

Comments

@jfloodnet
Copy link

jfloodnet commented Aug 21, 2024

Before opening, please confirm:

JavaScript Framework

React

Amplify APIs

Authentication

Amplify Version

v6

Amplify Categories

auth

Backend

None

Environment information

# Put output below this line


Describe the bug

Hi, so I'm going through the upgrade for v5 to v6. Was a lot of work to just get it to the point that I could attempt to run anything.

However, there is no upgrade path for people who used a "custom storage" provider for auth.

Please see the v5 definition for Auth config: https://docs.amplify.aws/gen1/javascript/prev/tools/libraries/configure-categories/

image

Expected behavior

v6 would offer some equivalent method of customising the storage of tokens and attributes

Reproduction steps

Migrate v5 to v6

Code Snippet

// Put your code below this line.

Log output

// Put your logs below this line


aws-exports.js

export default {
    Auth: {

        // identityPoolId: 'XX-XXXX-X:XXXXXXXX-XXXX-1234-abcd-1234567890ab',

        region: region,

        // identityPoolRegion: 'XX-XXXX-X',

        userPoolId: userPoolId,

        userPoolWebClientId: appClientId,

        identityPoolId: identityPoolId,

        providerKey: `cognito-idp.${region}.amazonaws.com/${userPoolId}`,

        mandatorySignIn: true,

        storage: CustomUserStorage,
    }
}

Manual configuration

No response

Additional configuration

No response

Mobile Device

No response

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

No response

@jfloodnet jfloodnet added the pending-triage Issue is pending triage label Aug 21, 2024
@jfloodnet
Copy link
Author

If there is an alternative api provided in v6, please provide documentation on how one could migrate their custom storage implementation to it.

@israx
Copy link
Member

israx commented Aug 21, 2024

Hey @jfloodnet. Thank you for upgrading to v6. You can provide your own Storage mechanism by implementing the KeyValueStorageInterface interface. You can find the Custom Storage section in the following documentation

@jfloodnet
Copy link
Author

Thank you @israx I think you could add something to the migration docs https://docs.amplify.aws/gen1/react/build-a-backend/troubleshooting/migrate-from-javascript-v5-to-v6/

The current docs don't do a great job of instructing how to actually upgrade the config. It points you to to where you can see the v6 config schema, but you're then on your own.

image

Once we've arrived here, you hit a dead end https://docs.amplify.aws/gen1/react/build-a-backend/auth/set-up-auth/#set-up-and-configure-amplify-auth

Even a little note in the v6 auth config section that hints that this custom storage api is registered via a different method in v6 and point the user to the link you gave me.

image

@israx
Copy link
Member

israx commented Aug 21, 2024

Thanks @jfloodnet for bringing this up. I created a task in our backlog to add specific documentation to migrate the use cases of Amplify.configure in v5.

@cwomack cwomack added documentation Related to documentation feature requests Auth Related to Auth components/category and removed pending-triage Issue is pending triage labels Aug 21, 2024
@cwomack cwomack self-assigned this Aug 21, 2024
@cwomack
Copy link
Member

cwomack commented Sep 24, 2024

@jfloodnet, thanks again for creating this issue. We'll be tracking the docs improvement within the above linked docs issue #7981. Feel free to follow that for updates on when the docs update gets merged in, but I'll back to this issue with a comment when it's complete as well.

@cwomack cwomack closed this as completed Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auth Related to Auth components/category documentation Related to documentation feature requests
Projects
None yet
Development

No branches or pull requests

3 participants