bespoken/virtual-device-sdk

Ability to provide my own bearer token from account linking

Closed this issue · 3 comments

Is your feature request related to a problem? Please describe.
I'd like to be able to control which account I'm linked to before I initiate the test.

Describe the solution you'd like
It would be great if there was an additional parameter that would let me pass in a bearer token (similar to how you can with the unit test library), that would allow me to conduct the account linking on my own through my own scripting means and then to simply pass the bearer token that I want the skill to utilize.

Describe alternatives you've considered
I'm not aware of any other way to accomplish this. In fact, I'm not even sure if it's possible.

Hi @dgreene1, apologies we did not reply to this sooner.

There is no way to pass a token when using the virtual devices. But your skill will receive a token that relates to the account the virtual device is setup with.

So, if you had a Selenium script that did the account linking, and linked it to the account associated with your virtual device, it would "just work". Does that make sense? And am I understanding what you are trying to do correctly?

@jkelvie, the only issue with that is that our authentication provider that supplies the token expires the token (as a security feature). So we would have to continually re-link the account if I understand correctly. That would lend a manual aspect to the automated tests and therefore defeat the purpose.

If you just plainly invalidate the access token, I don't know of a way to handle this without using Selenium for scripting.

Alexa does provide a mechanism for refreshing and expiring tokens - if your OAuth provider supports that, you can avoid this issue:
https://developer.amazon.com/docs/account-linking/configure-authorization-code-grant.html#tokens