The issue I’m facing is that when I make the call to a Restful API on AWS"s Gateway API Platform to reach the lambda on the backend running dwollav2 on python it keeps throwing CORS errors:
Access to fetch at 'https://bv2kys09u8.execute-api.us-west-2.amazonaws.com/Production/dwolla' from origin 'https://www.yourlandloans.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Credentials' header in the response is '' which must be 'true' when the request's credentials mode is 'include'.
I was able to overcome the first CORS error but this one is where I’m running into issues. It appears the Drop-in is passing “Access-Control-Allow-Credentials: true” but I don’t see a way to pass my authentication token along with the call? I’ve disabled authentication on this API for testing but no luck. Tests from postman (with auth disabled) work great so it does appear it is likely a CORS related issue.
Hmm…the only thing I can think of is that your AWS endpoint is probably can’t be reached via the client-side. Since calls from Postman are working fine, I would assume that if calls are made to that endpoint from the server-side of your application, that they would go through.
Perhaps you could have a function in your app’s server-side (like in this example) that calls the AWS lambda to generate client-tokens, and then you would set your tokenUrl key in the above configuration to that server-side URL you created in your app (example here).
Thanks for taking the time to respond back to me. I feel like there’s some component of this that I’m not understanding. I’ve reviewed everything I can find on the subject across all these locations:
Testing this works great except for the Drop-In reaching the API Gateway (seemingly due to CORS). Is the the Drop-In not supposed to reach to the backend via an API for the token via the “TokenUrl” value? Frankly, I’m a little confused by what y’all mean by “/tokenUrl”. Would you mind providing me an example there?
So I was able to work around this for now by forcing the API to respond with a "Access-Control-Allow-Credentials: ‘true’ " So that’s good! However, this is far from optimal since I now have an API that requires no authentication to call that creates Client-Tokens and hands them out to whoever Willy-Nilly. Is there any way to pass the end customers JWT to the Drop-In so that it can be used to authenticate against the API?
Any assistance with regard to the above question about passing some kind of JWT to the Drop-ins for the necessary API calls when obtaining Client-Tokens?
This was exactly the solution I was looking for! A suggestion I would make is to get this solution added to the API documentation if it isn’t in there already. I looked for quite a while for a solution through all the different forums and API docs and couldn’t find anything that worked for me.
Noted! We’ll work on adding this info to the docs as we work on improving our documentation for the Drop-ins Components. Thanks for the feedback, @TranZynergy!
[quote=“vic, post:7, topic:7933, full:true”]
Hey @shreya, in the solution above, what additional headers do we pass in? Because after implementing the dwollaAPIToken method, I get some sort of typerror as well as a cors error.
Also is there a reason why can’t this be configured server side. Looking forward to hearing back from you. Thanks. @shreya@spencer@Thom_Hotka