Pass through a path for Twitter to redirect back to?


Sorry if this is covered somewhere, but I read through the Twitter dev oauth docs and have searched around but I’m not finding an answer to this.

On our site users can authenticate to via Twitter, then they get returned to our site. What we want to do is if a non-authenticated user hits /settings, we want to pass /settings in the oauth flow so that when they’ve signed in, they’re redirected back to /settings .

Is this a supported option? If so, can someone link me to the specific documentation?


Part of OAuth 1.0A is specifying an explicit oauth_callback URL on the oauth/request_token step – the value you specify there is the URL the user will be redirected to following completion of the OAuth flow.

So when your users is on and beginning the Twitter auth experience, you’ll make a call to oauth/request_token with an oauth_callback pointing to and then send the user to oauth/authorize, after which they’ll land on and you’ll then invoke the last step, exchanging the request token and oauth_verifier for their access token.