Comments (3)
@Rajan-Gupta1 Thank you for your report! Are you trying to use Amplify JS v6? You should be able to use RXJS' from
utility on the response promise, for example:
const getOperation = get('apiName', '/getData');
return from(getOperation.response);
from amplify-js.
@jimblanc Thanks for your response. The challenge I am having is that it is forcing me to make the function async since now I am unable to provide the Authorization token in awsconfig in the configuration like I was able to like this:
{
name: "chimeAPI",
endpoint: environment.medBodyCareAPI_endpoint,
custom_header: async () => {
return { Authorization: Bearer ${(await Auth.currentSession()).getIdToken().getJwtToken()}
}
}
},
Now I am having to provide get the idToken as await
const authToken = (await fetchAuthSession()).tokens?.idToken?.toString();
which is making me mark the function async.
How do you suggest that your above suggestion will work when authorization token is needed and an observable using from must be returned?
from amplify-js.
@Rajan-Gupta1, did you only experience this when upgrading to v6? And can you provide any context on why you're not looking to have the functions async?
You can get the tokens needed elsewhere for your custom header (using await) or convert your function to async. But I don't think there's going to be a way around making things async/await if I'm understanding your use case properly.
from amplify-js.
Related Issues (20)
- Support for Content-MD5 header irrespective of objectlock. HOT 4
- Using backend for both React Native and Custom Admin page with React JS HOT 9
- Feature Request: Amplify Gen2 SelectionSet Support for CustomQueries
- Feature Request: Amplify Gen 2 - Define Global SelectionSets in resource.ts
- AuthError is an unexpected type calling getCurrentUser() with no authenticated user. HOT 2
- Add dynamic content to Autocomplete HOT 1
- amplify/auth resetPassword succeeds but customSmsSender trigger lambda never called HOT 3
- Federated Sign-in - App Sync list query Auth Error HOT 2
- Amplify not works well if I have configuring multiple user pools with condition
- Next, js, Amplify js.fetchAuthSession({forceRefresh: true}) does not work as expected and returns tokens as undefined. How to manage a refresh token in Amplify v6 in Next.js HOT 4
- Amplify CLI Gen 2 - Multiple SortKeys combined into one input with GraphQL Generation HOT 5
- AWS storage upload issue HOT 2
- Datastore.save() sending _version of previous query model instead of current model. HOT 2
- runWithAmplifyServerContext throwing error, ⨯ Error: Cannot access Cognito.length on the server. You cannot dot into a client module from a server component. You can only pass the imported name through. HOT 4
- 6.3.3 is stable ? HOT 1
- ResizeObserver loop when navigating in the Authenticator component
- [v6] resetPassword not trigger UserMigration lambda HOT 2
- Add timeout on GET and POST api calls for amplify v6 HOT 2
- No federated JWT token when using AppSync OIDC in Amplify Gen2 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from amplify-js.