Dorpin Github - encountered an issue fetching a token

I have downloaded drop-ins-examples-main.zip. Just replaced the code with sandbox client id and secret. I can see it’s successfully generating token in create-customer.hbs @ line 26 (token: () => Promise.resolve({{ token }}`),’, however @ line 28 (error: (err) => console.log(err)) I am getting error
‘We have encountered an issue fetching a token.’

Also when I went ahead and clicked ‘Agree and Continue’ button noticed that it’s not populating Token in the cURL (see below)

curl ‘https://api-sandbox.dwolla.com/customers
-H ‘authority: api-sandbox.dwolla.com
-H ‘sec-ch-ua: “Google Chrome”;v=“93”, " Not;A Brand";v=“99”, “Chromium”;v=“93”’
-H ‘sec-ch-ua-mobile: ?0’
*-H ‘authorization: Bearer’ *
-H ‘content-type: application/vnd.dwolla.v1.hal+json’
-H ‘accept: application/vnd.dwolla.v1.hal+json’
-H ‘user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36’
-H ‘x-requested-with: Dwolla-Drop-Ins-Library’
-H ‘sec-ch-ua-platform: “macOS”’
-H ‘origin: http://localhost:4041
-H ‘sec-fetch-site: cross-site’
-H ‘sec-fetch-mode: cors’
-H ‘sec-fetch-dest: empty’
-H ‘referer: http://localhost:4041/
-H ‘accept-language: en-US,en;q=0.9,te;q=0.8’
–data-raw ‘{“firstName":“t”,“lastName”:“t”,“email”:"t@t.com”}’
–compressed

Hi @cloudaplusllc – is this happening consistently for you when you try to create a customer? Do you have the approximate timestamp of when this occurred? It could have been a connection issue or a blip.

Thanks for the quick response. Yes it’s consistent. Can you please confirm I need to make can code changes in this snippet below?
dwolla.configure({
environment: “sandbox”,
styles: “/styles/create.css”,
token: () => Promise.resolve({{ token }}),
success: (res) => Promise.resolve(),
error: (err) => Promise.resolve()
});

Ah, looks like the example code for non-flow components have yet to be updated with the new “token” key-value pair updates.

This line in the code example needs to be updated to the following -

token: (req) => Promise.resolve({token: 'token123abcd'})

Thanks for reporting this! We’ll get the example repo updated!

Thanks for the hint. It works fine after replacing it with
token: (req) => Promise.resolve({token: '{{ token }}'}) .

1 Like