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

Amplify Auth v6 - CookieStorage not working in Localhost #13344

Closed
3 tasks done
hanoj-budime opened this issue May 7, 2024 · 3 comments
Closed
3 tasks done

Amplify Auth v6 - CookieStorage not working in Localhost #13344

hanoj-budime opened this issue May 7, 2024 · 3 comments
Assignees
Labels
Auth Related to Auth components/category question General question

Comments

@hanoj-budime
Copy link

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

Error at fetchUserAttributes :>>  Error: Network error
    at fetchTransferHandler (:3000/node_modules/.vite/deps/chunk-OF4A5D2P.js?v=2f1ea17f:9074:13)
    at async retryMiddleware (:3000/node_modules/.vite/deps/chunk-OF4A5D2P.js?v=2f1ea17f:8748:20)
    at async userAgentMiddleware (:3000/node_modules/.vite/deps/chunk-OF4A5D2P.js?v=2f1ea17f:9024:24)
    at async :3000/node_modules/.vite/deps/chunk-OF4A5D2P.js?v=2f1ea17f:9115:22
    at async fetchUserAttributes (:3000/node_modules/.vite/deps/chunk-KDJGD37D.js?v=2f1ea17f:6670:30)
    at async fetchUserAttributes (:3000/src/services/amplify.js:80:18)
    
error :>>  Error: Network error
    at fetchTransferHandler (:3000/node_modules/.vite/deps/chunk-OF4A5D2P.js?v=2f1ea17f:9074:13)
    at async retryMiddleware (:3000/node_modules/.vite/deps/chunk-OF4A5D2P.js?v=2f1ea17f:8748:20)
    at async userAgentMiddleware (:3000/node_modules/.vite/deps/chunk-OF4A5D2P.js?v=2f1ea17f:9024:24)
    at async :3000/node_modules/.vite/deps/chunk-OF4A5D2P.js?v=2f1ea17f:9115:22
    at async fetchUserAttributes (:3000/node_modules/.vite/deps/chunk-KDJGD37D.js?v=2f1ea17f:6670:30)
    at async fetchUserAttributes (:3000/src/services/amplify.js:80:18)

Expected behavior

Update token-saving mechanism

Cookie Storage
https://docs.amplify.aws/react/build-a-backend/auth/concepts/tokens-and-credentials/#update-your-token-saving-mechanism

Reproduction steps

  1. Install Amplify v6
  2. Update token-saving mechanism with Cookie Storage

Code Snippet

This code not working for localhost

import { Amplify } from 'aws-amplify';
import { CookieStorage } from 'aws-amplify/utils';
import { cognitoUserPoolsTokenProvider } from 'aws-amplify/auth/cognito';

const authConfig = {
  Cognito: {
    userPoolId: 'your_user_pool_id',
    userPoolClientId: 'your_user_pool_client_id'
  }
};

Amplify.configure({
  Auth: authConfig
});

cognitoUserPoolsTokenProvider.setKeyValueStorage(new CookieStorage());

Log output

// Put your logs below this line


aws-exports.js

No response

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

@hanoj-budime hanoj-budime added the pending-triage Issue is pending triage label May 7, 2024
@cwomack cwomack added the Auth Related to Auth components/category label May 7, 2024
@cwomack cwomack self-assigned this May 7, 2024
@cwomack
Copy link
Member

cwomack commented May 7, 2024

Hello, @hanoj-budime 👋. The fact that you're getting a network errors makes me wonder if we need more details about what API's are being called and how Auth has been setup. Can you clarify if you experience this same errors for all API's? Are you able to share the fronted code that's calling the Auth API's that are causing this?

@cwomack cwomack added question General question pending-response and removed pending-triage Issue is pending triage labels May 7, 2024
@hanoj-budime
Copy link
Author

image
image
image

@lucasantunes-ciandt
Copy link

Hello @hanoj-budime, were you able to fix this issue? I'm having a similar issue, with also several Cognito Requests resulting in errors.

@github-actions github-actions bot added the pending-maintainer-response Issue is pending a response from the Amplify team. label Dec 19, 2024
@hanoj-budime hanoj-budime closed this as not planned Won't fix, can't repro, duplicate, stale Dec 20, 2024
@github-actions github-actions bot removed the pending-maintainer-response Issue is pending a response from the Amplify team. label Dec 20, 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 question General question
Projects
None yet
Development

No branches or pull requests

3 participants