针对.Net Odata Web Api使用Excel Power Query进行身份验证 [英] authenticating with Excel Power Query against .Net Odata Web Api

查看:126
本文介绍了针对.Net Odata Web Api使用Excel Power Query进行身份验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Power Query下载使用.net Web Api 2和OData v4 nuget包创建的Odata Feed.

I am trying to use Power Query to download an Odata Feed that I created using .net Web Api 2 and the OData v4 nuget package.

我正在尝试访问需要身份验证的Odata提要.在超级查询中编辑身份验证类型时,我从没看到请求中通过身份验证密钥.

I'm trying to access an Odata feed that requires authentication. When I edit the authentication type in power query, I'm never seeing the authentication key come through in the request.

如何配置Power Query以使用特定类型的身份验证?

How do you configure Power Query to use a specific type of authentication?

奖金:我使用的是OAuth,所以我将如何配置电源查询以发送带有包含"Authorization Bearer:token_here"的auth数据的标头

Bonus: I'm using OAuth, so how would I configure power query to send in a header with auth data that includes "Authorization Bearer:token_here"

推荐答案

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.)

这篇关于针对.Net Odata Web Api使用Excel Power Query进行身份验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆