简体   繁体   English

如何从 Owin 上下文中获取查询字符串参数?

[英]How do I get query string parameters from an Owin context?

When working against the instagram API, it requires the client to capture ?code=[some code] from a successful OAuth response:在处理 instagram API 时,它需要客户端从成功的 OAuth 响应中捕获?code=[some code]

Step Two: Receive the redirect from Instagram第二步:接收来自 Instagram 的重定向

Once a user authorizes your application, we issue a redirect to your redirect_uri with a code parameter to use in step three.用户授权您的应用程序后,我们会向您的 redirect_uri 发出重定向,其中包含要在步骤三中使用的代码参数。

http://your-redirect-uri?code=CODE

By default the OWIN middleware causes a redirect to /signin-instagram where the request is handled and then passed on to a new path that I choose (eg /oauth/instagram ) where I get access to an OWIN context.默认情况下,OWIN 中间件会导致重定向到/signin-instagram处理请求,然后传递到我选择的新路径(例如/oauth/instagram ),在那里我可以访问 OWIN 上下文。

Because of the chained redirects the code querystring value is lost and it seems that I need a way to retrieve it from the OWIN context, but I can't find one.由于链式重定向, code查询字符串值丢失了,似乎我需要一种从 OWIN 上下文中检索它的方法,但我找不到。

The answer is that you don't.答案是你没有。 The owin provider should be (and is for Instagram) fetching anything relevant on the querystring and insert it into the Claims owin 提供者应该(并且适用于 Instagram)获取与查询字符串相关的任何内容并将其插入到Claims

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM