Getting Started with the Rails oAuth2 gem

Hello,
I’m quite new to the FreeAgent APi, but I’ve successfully worked with other
oAuth-based APIs before without too many problems, but I’m struggling to
find my way around this.

Using the code example snippets from the oAuth2 gem GitHub page
(https://github.com/intridea/oauth2), I’ve created just two lines of code
that should generate the “authorize URL”, but when I click the link they
generate, I get the following error;

"Format not recognised. Set accept http header to application/json or 

application/xml".

In the controller, I’ve included (with my variables changed);

freeagent_api = OAuth2::Client.new(client_id, client_secret, :site => 

https://api.freeagent.com/v2/’)
@oauth_url = freeagent_api.auth_code.authorize_url(:redirect_uri =>
http://example.com/fa-oauth-redirect’)

And in the view, a simple

=link_to "Connect with FreeAgent", @oauth_url

This seems pretty self-explanatory, but I’ve not encountered this before,
using other APIs this way, so I’m not sure what the correct way to add
these to the code Rails uses for this is.

Has anyone overcome this before?

Any help would be much appreciated!

Thanks

Matt