0
votes

I am writing an Azure Function (trying) to fetch data from an external API to be returned to Power BI. I started with the code mentioned on this page, but there appears to be a few things left out, such as the definition of the Tokens/Token classes. I've been fiddling around with it for a few hours now, and just cannot get this to work properly.

I have created the class Tokens, but another class (Token, singular) is referenced elsewhere. I've created a fiddle with what I have so far, it's a bit broken as dotnetfiddle doesn't seem to work nice with Azure Functions.

1
Could you please provide your error message? - Jim Xu
Is the table storage referred here a Azure Table Storage or Azure CosmosDB Table API? Do you need the output bindings when you are already inserting the tokens in your code? - Kalyan Chanumolu-MSFT
This is an Azure Storage Table that I want to use. Basically, it will store all the refresh tokens, as a new token is issued after each request, and subsequent requests will need to use the new token. If there is a simpler method, I am all ears. - TaylorN

1 Answers

0
votes

You may consider using a managed OAuth service that stores the tokens for you. In addition to handling the refresh token part (like making sure that the new refresh token replaces the old refresh token), it will also include a lot more security (e.g. token encryption) than the example you linked to.

For cloud functions, keeping the surface area small is usually a good architectural decision.

Disclosure: I work at Xkit, a managed OAuth provider.