Ruby OAuth2 client
<p>I'm trying to create a script to access the <a href="https://quizlet.com/api/2.0/docs/authorization-code-flow" rel="nofollow">Quizlet API</a> </p>

<p>Those API are protected with OAuth2 and I'm using this <code>oauth2</code> ruby gem <a href="https://github.com/intridea/oauth2" rel="nofollow">https://github.com/intridea/oauth2</a></p>

<p>The gem's GitHub page shows an example but for me doesn't work and I feel I'm missing some pieces.
This is part of the example:</p>

<pre><code>client.auth_code.authorize_url(:redirect_uri =&gt; 'http://localhost:8080/oauth2/callback')
# =&gt; "https://example.org/oauth/authorization?response_type=code&amp;client_id=client_id&amp;redirect_uri=http://localhost:8080/oauth2/callback"

token = client.auth_code.get_token('authorization_code_value', :redirect_uri =&gt; 'http://localhost:8080/oauth2/callback', :headers =&gt; {'Authorization' =&gt; 'Basic some_password'})
</code></pre>

<p>Two quetions:</p>

<ul>
<li>What should I do with the result of <code>authorize_url</code>?  This url should be opened on a browser to proceed with the login, but the gem doesn't open it automatically. Should I ask the user to do so?</li>
<li>What about the callback URL? The example uses <code>http://localhost:8080/oauth2/callback</code> but is not clear if the gem itelf is in charge of listening on that port. </li>
</ul>

<p>Any advices?</p>