尝试发布推文API V1(C#)时未经授权

发布于 2025-01-28 06:28:40 字数 1007 浏览 3 评论 0 原文

早晨,

我已经有一段时间没有发布了,但是我需要问这个问题,我花了一天半的时间试图使它工作 - 考虑到我设法通过发布了V2,这真是令人沮丧在2-3个小时内发推文,但由于我需要媒体端点(在V2中不存在),所以我将流程重建为V1上传媒体。

好的,所以我的应用程序允许用户使用Twitter和Tweet/上传媒体进行身份验证。我正在使用(我认为)三足的OAuth流。

当前,流量为:

以上所有内容都符合文档中的内容,但是当我使用步骤3的存储值以发布一条推文时,我将获得未经授权。

签名逻辑有效,因为它是“请求访问令牌”中使用的,并进行了几次更改。

由于尝试了各种Nuget软件包(尤其是Tweetinvi),我正在学习更多问题问题,并且我也得到了例外。

任何帮助将不胜感激。

Morning all,

I've not posted on SO for quite some time, but I need to ask the question, I’ve spent a day and a half trying to get this to work - it’s super frustrating considering I managed to implement v2 with posting a tweet in 2 - 3 hours but because I need the media endpoint (does not exist in v2), I rebuilt my flow into v1 to upload media.

Ok, so my app allows the user to authenticate with twitter and tweet/upload media. I’m using (I think) the 3-legged oauth flow.

Currently, the flow is :

All of the above conforms to what is in the docs, but when I use the stored values from step 3 to post a tweet I get unauthorized.

The signing logic works because it’s what’s used in “Request access token” - with a couple of changes.

I'm learning more towards a flow issue due to trying various nuget packages(tweetinvi in particular) and I get exceptions in those too.

Any help is greatly appreciated.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

椵侞 2025-02-04 06:28:40

并不是真正的答案,而是显着的行动。

在此时间点,您无法使用API​​的V2上传媒体,尽管您可以很快整合并发送推文,但没有媒体,它几乎毫无意义。

因此,您需要与V1建立/集成。

未知和曲线球:

  • 最重要的! V1需要提升访问!你需要
    申请,并非全部被接受!但是v2只是与
    没有提升的访问 - 非常奇怪。
  • 始终确保正确读取响应,并尝试几次代码,Postman,
    提琴手等。虽然RESP包含一个错误对象的集合,但
    您将永远不会收集错误。
  • 如果您不使用任何类型的软件包/库,请密切注意
    为了制作请求签名 - 这很痛苦。

Not really an answer per-se, but rather notable actions.

At this point in time, you cannot upload media with V2 of the API, whilst you can integrate quite quickly and send a tweet, it's almost pointless without media.

So, you'll need to build/integrate with V1.

The unknowns and curve balls:

  • The most important! V1 requires elevated access! Which you'll need to
    apply for, not all get accepted! but V2 just integrate and tweet with
    no elevated access - very strange.
  • Always ensure to read the resp correctly, and try few times in code, postman,
    fiddler etc. Whilst the resp contains a collection of errors object,
    you'll never get a collection of errors.
  • If you're not using any sort of package/library, pay close attention
    to crafting the request signature - it's a pain.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文