Invalid access token while using Dwolla card.js

@shreya @kmoreira I am facing error “Invalid access token”, randomly when I try to add card using dwolla card.js

Hi @sud

Our tokens are valid for up to 60 min. You can create a new one after this time or utilize your key and secret to automate

@shreya @kmoreira
I was talking about scenario, when I have created card funding source token and pass it into Dwolla card.js UI. After that when I fill out card details and click “Go”, randomly it gives this "Invalid access token”

Hey @sud – would you be able to share an example Customer Id for whom you’ve tried generating card-tokens? We can take a look at our logs to see what’s up!

@shreya @kmoreira
Customer id: 37407656-b27b-4e43-8959-289ef43da893
Customer type: Receive only

My Dwolla account email id :

Thanks, @sud!

Will take a look and let you know what we find or if need any more info!

Hey @sud , looking at the logs, it looks like your code might be attempting to use a card token that has already been used up. I would double check that a fresh new token is being generated every time the card form is being called.

@shreya Nope. I know we can use card token only once, But sometimes it throws error “Invalid access token” error with new token as well

Can i get any reply for this?

Hey @sud – I’m asking our dev team to take a look into this again.

The tokens are one-time use (even if the first call to the API to create a funding source fails, a new token will need to be generated). Other than that we haven’t been able to reproduce this.

Hey @sud – would you be able to check if you are using idempotency-key header with your requests to generate a token?

I’m wondering if that’s what’s causing the same card token to be returned in the response, like in this other thread.

No, We are generating token without using idempotency-key. Should i use this key?

Hi @sud

The idempotency key prevents an operation from being performed more than once.

We tried recreating this error, and we can only get this error to occur when we reuse a card token to add a second card with it. Since it’s a one time use token, you need to make sure you’re generating a new token each time you create a new card.

I am generating a new token every time before creating the card. still its giving invalid token some time.

Hi @sud

What are you doing differently in the times where it is throwing the invalid token error?

I am reloading card.ejs again and try again to add the card. So the second time it is working.

@kmoreira just following up here, did you get a chance to look into this issue?

Hi @sud

Not sure if you still need help of this, but this sounds like a loading or binding error. Without looking at the way the code is structured I can make the assumptions that something isn’t binding dynamically to the event or there is a function being executed prior to another which may be taking longer to run in the first attempt