简体   繁体   English

使用oauth2发出带有“消费者令牌”的请求

[英]Make a request with an “consumer token” with oauth2

I'm using intridea/oauth2 for oauth2 functionality. 我将intridea / oauth2用于oauth2功能。 Everything is working fine with authentication and making requests with an access token. 身份验证一切正常,并使用访问令牌发出请求。

But what i can not find out is how to make a request without an access token. 但是我找不到的是如何在没有访问令牌的情况下发出请求。 I thought it would simply work with 我以为它可以和

client = OAuth2::Client.new(key, secret, :site => site)
client.request(:post, "/api/users", {params: {param1: "val1"}})

but that does not seem to work. 但这似乎不起作用。 It is not setting any oauth header in the request. 它没有在请求中设置任何oauth标头。

How do i make a request like that? 我该如何提出要求?

Leave out oAuth completely then. 然后完全忽略oAuth。 Use simple Net::HTTP requests or use a library like REST Client for example. 例如,使用简单的Net::HTTP请求或使用类似REST Client的库。

It seems like the library isn't capable of something like that. 似乎该库不具备这样的功能。 So i now have two ways of authentication. 所以我现在有两种认证方式。 You can find some information on this page: http://railscasts.com/episodes/352-securing-an-api?view=asciicast 您可以在此页面上找到一些信息: http : //railscasts.com/episodes/352-securing-an-api?view=asciicast

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

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