Want to use OAuth to authenticate against the API?
Here are the relevant URLs:
- Get a request token at
- Redirect users to
https://getsatisfaction.com/api/authorize?oauth_token=XXXto authorize a request token
- Exchange an authorized request token to get an access token at
Logging in a user using OAuth
Using this system you will be able to craft a special URL that will log a user into the appropriate Get Satisfaction account and redirect them on through to their destination.
Overview of the steps
- Getting an access token: First you need to have your user grant access to act on their behalf. Using the normal OAuth interaction, generate and store an access token/secret in your database.
- Generating the special URL: You will then use this access token/secret to generate an authenticated OAuth call to
- Using the special URL in a link: Render a link in your page to this special URL, and if/when the user clicks on the link, they will be logged into Get Satisfaction if they aren’t already.
Getting an Access Token
Nothing different here than any OAuth token exchange.
- Get a request token,
- redirect user to the authorization page,
- exchange request token for access token.
You will want to store this access token in your database, attached to the user account in your system who is currently signed in to your application. This token represents the link between the user’s account on your system and on Get Satisfaction.
Generating a special URL
You create a URL signed properly with the Access Token retrieved in step 1. The URL will be to
/session/from_oauth and you will want to sign it as a GET request. Since this URL will be embedded into a link, you won’t be able to use the Authorization HTTP header method, so you should use the query string to supply the appropriate OAuth variables (token, nonce, signature, timestamp, signature method, consumer key, etc.).
Care should be taken to not cache this URL in your rendered HTML, since the first person to follow the link will be logged in as the attached user.
To redirect the user into a specific page in Get Satisfaction, you can supply an additional query string parameter. By specifying
redirect=blah in the query string, Get Satisfaction will redirect the user on through to the URL specified in the parameter after setting all of the appropriate cookies to keep a user logged into satisfaction. Don’t forget to include the redirect parameter (if used) when calculating the signature used for OAuth verification.
Please note that at present any cookies set using this method will always be session cookies; the user will be logged out of Get Satisfaction when they close their browser.