Skip to content

Commit

Permalink
fixed OAuth2 authorization example
Browse files Browse the repository at this point in the history
redirect_uri should be set once. also uri was not defined
clarified redirect workflow
  • Loading branch information
mschneider committed Jul 27, 2011
1 parent 50f8971 commit 74c7d4c
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions README.md
Expand Up @@ -42,11 +42,14 @@ It is providing simple methods to handle authorization and to execute HTTP calls
client = Soundcloud.new({
:client_id => YOUR_CLIENT_ID,
:client_secret => YOUR_CLIENT_SECRET,
:redirect_uri => YOUR_REDIRECT_URI,
})

client.authorize_url(:redirect_uri => REDIRECT_URI)
# => "https://soundcloud.com/connect?client_id=YOUR_CLIENT_ID&response_type=code&redirect_uri=http://host/redirect"
client.exchange_token(:redirect_uri => uri, :code => 'CODE')
redirect client.authorize_url()
# the user should be redirected to "https://soundcloud.com/connect?client_id=YOUR_CLIENT_ID&response_type=code&redirect_uri=YOUR_REDIRECT_URI"
# after granting access he will be redirected back to YOUR_REDIRECT_URI
# in your respective handler you can build an exchange token from the transmitted code
client.exchange_token(:code => params[:code])

#### OAuth2 refresh token flow, upload a track and print its link
# register a new client which will exchange an existing refresh_token for an access_token
Expand Down

0 comments on commit 74c7d4c

Please sign in to comment.