且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

针对.Net Odata Web Api使用Excel Power Query进行身份验证

更新时间:2023-11-30 23:29:22

Web API凭据用于向URL查询中添加秘密值(即,您对某些网站的API密钥).

Web API credentials are for putting a secret value into to the URL query (i.e. your API key for some website).

当前无法从凭据对话框在Power Query中添加自己的Bearer令牌.

There's currently no way to add your own Bearer token in Power Query from the credential dialog.

它的安全性较差并且无法刷新,但是您可以使用OData.Feed的Header参数直接对凭据进行硬编码:

It's less secure and can't be refreshed, but you can hardcode your credential directly using OData.Feed's Header parameter:

= OData.Feed("http://localhost/", null, [Headers = [Authorization = "Bearer token_here" ] ])

(或者,将服务器配置为接受Power Query支持的基本身份验证可能更容易.)

(Alternatively, it might be easier to configure your server to accept Basic auth, which is supported in Power Query.)