REST API call not taking place when Auth & API used simultaneously inside Amplify.configure block. Page needs to be re-loaded manually to get data on the page after authentication.
See original GitHub issuePost authentication React page is getting stuck with loading status as REST API call is not taking place and hence page needs to get re-loaded manually for REST API call to take place. There are no suggestions on how to handle both Auth & REST API call manually in Amplify.configure block. Tried using the suggested methods on - https://docs.amplify.aws/lib/graphqlapi/create-or-re-use-existing-backend/q/platform/js#using-openid_connect , but no luck. Can someone please suggest an alternative or suggest on how to get this fixed.
Amplify.configure({
Auth: {
region: 'us-east-1',
userPoolId: process.env.REACT_APP_USERPOOL_ID,
userPoolWebClientId: process.env.REACT_APP_USERPOOL_WEB_CLIENT_ID,
oauth: {
"domain": "xxxxx-dev.auth.us-east-1.amazoncognito.com",
"scope": [
"phone",
"email",
"openid",
"profile",
"aws.cognito.signin.user.admin"
],
"redirectSignIn": "http://localhost:3000/",
"redirectSignOut": "http://localhost:3000/",
"responseType": "code",
}
},
API: {
endpoints: [
{
name: "MyAPIGatewayAPI",
endpoint: process.env.REACT_APP_APIG_ENDPOINT,
region: 'us-east-1',
custom_header: async () => {
return { Authorization: (await Auth.currentSession()).idToken.jwtToken };
}
}
]
}
});
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Calling REST Api that requires auth from localhost ... - GitHub
The problem occurs if I reload the page. Either manually or because of live reload after changing something in the frontend code. If...
Read more >API (REST) - Getting started - JavaScript - AWS Amplify Docs
Manual Setup: Reference existing REST API For manual configuration you need to provide your AWS Resource configuration and optionally configure authentication.
Read more >AWS Amplify Fullstack Project Setup (React, Node ... - YouTube
AWS Amplify is a CLI toolchain to help you build and deploy applications quickly. In this Step by Step Tutorial video, I show...
Read more >API - Guide - SoundCloud Developers
In order to integrate with Soundcloud you need to authorize your application. SoundCloud authentication uses OAuth 2.0, a popular open standard used by...
Read more >AWS Amplify: Using Existing Auth and API Resources
In this post, let's explore how we can configure a Cognito Pool for user authorization, a RESTful API with ApiGateway, and finally connect ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks a ton @amhinson , upgrading the versions fixed the Loading issue.
This issue has been automatically locked since there hasn’t been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server
*-help
channels or Discussions for those types of questions.