Giter Club home page Giter Club logo

flattr's People

Contributors

galfert avatar julianyon avatar qzio avatar smgt avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

5apps leppert

flattr's Issues

No longer able to create new things

Hi Simon,

I recently found that creating new things no longer works for me.
I was still using the 0.3.0 version of the gem so first I upgraded to the latest 0.3.5 plus I upgraded to the latest Faraday and Multi_JSON gems.

However I still get this repsonse from my ruby script that worked fine until some days ago:

/Library/Ruby/Gems/1.8/gems/flattr-0.3.5/lib/flattr/response/raise_client_error.rb:15:in `on_complete': Not allowed to specify user for connection URL:s. (Flattr::Error::BadRequest)
    from /Library/Ruby/Gems/1.8/gems/faraday-0.7.6/lib/faraday/response.rb:9:in `call'
    from /Library/Ruby/Gems/1.8/gems/faraday-0.7.6/lib/faraday/response.rb:62:in `on_complete'
    from /Library/Ruby/Gems/1.8/gems/faraday-0.7.6/lib/faraday/response.rb:8:in `call'
    from /Library/Ruby/Gems/1.8/gems/flattr-0.3.5/lib/flattr/request/oauth2.rb:9:in `call'
    from /Library/Ruby/Gems/1.8/gems/faraday-0.7.6/lib/faraday/connection.rb:210:in `run_request'
    from /Library/Ruby/Gems/1.8/gems/faraday-0.7.6/lib/faraday/connection.rb:98:in `post'
    from /Library/Ruby/Gems/1.8/gems/flattr-0.3.5/lib/flattr/request.rb:34:in `send'
    from /Library/Ruby/Gems/1.8/gems/flattr-0.3.5/lib/flattr/request.rb:34:in `request'
    from /Library/Ruby/Gems/1.8/gems/flattr-0.3.5/lib/flattr/request.rb:18:in `post'
    from /Library/Ruby/Gems/1.8/gems/flattr-0.3.5/lib/flattr/client/things.rb:54:in `thing_new'
    from flattr_submit_thing.rb:66

It's not complaining about authentication or anything so I wonder if there were changes that are out of my scope? Has anything changed in the API recently?
As stated above - I had no changes in my script :(

Regards,
Tobi

Add basic auth support

Flattr supports basic auth to authenticate a user to the api. Would be nice if the gem supported basic auth.

Possibility to specify options on get_access_token (e.g. redirect_uri)

You can set the redirect_uri on

flattr.authorize_url(:scope => "email", :redirect_uri => "http://localhost:8000/oauth_endpoint")

but this is not possible on

flattr.get_access_token(code)

oauth2 fails with missing redirect_uri on querying access_token.

Patch:

diff --git a/lib/flattr/oauth2.rb b/lib/flattr/oauth2.rb
index ca8afd2..fa53a90 100644
--- a/lib/flattr/oauth2.rb
+++ b/lib/flattr/oauth2.rb
@@ -24,11 +24,12 @@ module Flattr
       "#{authorize_endpoint}/?#{query_string}"
     end

-    def get_access_token(code)
+    def get_access_token(code, opts = {})
+      default_options = {
-      response = post(token_endpoint, {
         :code => code.strip,
         :grant_type => 'authorization_code'
-      },{
+      }
+      response = post(token_endpoint, default_options.merge(opts), {
         :headers => {
           :authorization => "Basic #{Flattr::Client.base64_encode("#{client_id}:#{client_secret}")}"
         }}

now it is possible to set the redirect_uri on get_access_token:

access_token = flattr.get_access_token(code, :redirect_uri => "http://localhost:8000/oauth_endpoint")

Submit new thing from a client

Hi there,

this seems like a real noob problem but I just can't get it running.
I used your samples to get a code with which I can order access tokens. However I don't get an access token when I use the following code?!

# code has already been requested in another script with flattr.authorize_url(:scope => "thing")
code = "YXZ"  

Flattr.configure do |config|
  # get these from the command line
  config.client_id = options[:apikey]  
  config.client_secret = options[:sharedsecret]
end

flattr = Flattr.new
token = flattr.get_access_token code

# nil - WTF?
puts "new access_token #{token}"  

thing_opts = {}
a = flattr.thing_new("http://gatogatogato.ch/xxxxxxxxx",thing_opts)

# not good - I'm not authenticated :(
puts a.attrs['error_description'] 

What am I doing wrong? Been looking through all the files in the gem but I can't find anything that helps me here. :(

Regards,
gato

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.