Can i have more than 1 callback URL?


#1

I specified another url for my callback that has the same domain and everything, just that the file is different, but once i authenticated successfully, i get redirected to my Twitter page instead. I got this error message in Firebug on my twitter page:
uncaught exception: Error: Permission denied for https://twitter.com to get property Proxy.InstallTrigger

Does Twitter disallow all other callback urls other than the one given in the application settings? If Twitter does allow other callback urls, then what am i doing wrong?


#2

bump. does anyone know?


#3

Is this for an OAuth 1.0A based integration or a @Anywhere integration?

If it’s for a OAuth 1.0A integration: make sure you’re specifying your alternate callback on the oauth/request_token step and you have a “placeholder” already in place with your application record.

If you’re using @Anywhere: the domain used in the callback field is your first valid domain. You can add more by clicking on the domains tab on that application’s record. You’ll need an entry for each subdomain. It can take awhile for the app editor tool to reflect changes.


#4

Hi episod, thank you for the swift reply.

This is for OAuth 1.0A integration, and i am already specifying my alternate callback on the $connection->getRequestToken line. May i know what do you mean by “having a “placeholder” already in place with your application record”?


#5

ok i discovered my mistake; i was passing characters from other languages to my url, and i did not url_decode that when passing it to my php. once i fixed that this was solved.


#6

Hi guys, I’ve got a problem with my callback url, I’ve been looking for a solution and maybe you can help me, I hope so!.

I’ve got a callback url with special characters like: http://www.mywebsite1.com/(12df5r4fd5er)/page/name.aspx, so I’m doing a doble escape to the url before passing the headers to my web Request, and my url is taking this format: http%3A%2F%2Fwww.mywebsite1.com%2F%2812df5r4fd5er%29%2Fpage%2Fname.aspx

After the authentication proccess, the redirection to my web page is going wrong, because the url is coming in this way:
http://www.mywebsite1.com/(12df5r4fd5er)/page/name.aspx?oauth_token=Ko4d4sbjCIcWYKgdMFhrgglRjfbp72cOYGnZfSDJlI&oauth_verifier=0F2e3Ci3OUBT2ImG1DfFDs4iBw5KJmaGdS7DkHs

Please note that the “%28” and “%29” are refering the Left and rigth Parenthesis. I also tested escaping the url only once, but I get the following HTTP ERROR : 401 unauthorized.

So I don’t really know what to do with the specials characteres “(” “)” in my url. Maybe I’ve got to encode in a different way, like UTF8, but really I don’t know :S

(I’m using an OAuth 1.0A based integration and C#). Can you help me, please?


#7

What happens if you change your callback url in the application settings to

http://www.mywebsite1.com/(12df5r4fd5er)/page/name.aspx?oauth_token=Ko4d4sbjCIcWYKgdMFhrgglRjfbp72cOYGnZfSDJlI&oauth_verifier=0F2e3Ci3OUBT2ImG1DfFDs4

Meaning you reflect all of the special characters in the url


#8

Hi dloh!!.. thanks for your answer :slight_smile:

I did this test, but I get the same error .(Error: The remote server returned an error: (401) Unauthorized.), because characters like “:” “/” must be escaped as well. :S


#9

Is there a means to configure your webserver to understand that %28 and “(” are the same thing? (likewise for the trailing characters). Do you have an option to consume the OAuth callback on a different path entirely not containing such characters?


#10

Hi Taylor, well after much reading and reading and reading I’m in this situation:

  • first: about you say of "configure my webserver to understand that “%28”, I don’t know if is possible to do it, I was looking for information about this but got nothing
  • Second: I have no option to change the path 'cause it is a dynamic URL that is generated by the registered user and other directories

Finally, I was reading an oauth guide from “http://vimeo.com/api/docs/oauth” and found this in the section “Encoding”:

//-------
You’ll need to percent encode all of your parameters when creating your signature. These “reserved” characters must be converted into their hexadecimal values and preceded by a % character. The rest of the characters are “unreserved” and must not be encoded.

The reserved characters are:
! * ’ ( ) ; : @ & = + $ , / ? % # [ ]

These are the percent-encoded values of the above characters:
%21 %2A %27 %28 %29 %3B %3A %40 %26 %3D %2B %24 %2C %2F %3F %25 %23 %5B %5D

Unreserved characters include upper- and lower-case letters A through Z, numbers 0 through 0, and the dash, underscore, period, and tilde.

Be careful with URL encoding functions built into languages, they may not encode all of the reserved characters, or may encode unreserved characters.
----------------//

After reading that, I think the encoding I’m doing is okay! and maybe the problem is the way I’m opening the window for authorization, because I’m doing it with a window.open like this:

window.open(“https://api.twitter.com/oauth/authorize?oauth_token=IKNKfwv1gAmxswvsDeFF6nvwmlDRUpVUSTeDBmmZF8E”);

what do you think?


#11

Hi!.. Finally I discovered my problem (was the encoding!)… here is my end code:

public static string UrlEncode(string value)
{
if (string.IsNullOrEmpty(value))
{
return string.Empty;
}

value = UrlEncode(value);

// UrlEncode escapes with lowercase characters (e.g. %2f) but oAuth needs %2F
value = Regex.Replace(value, "(%[0-9a-f][0-9a-f])", c => c.Value.ToUpper());

// these characters are not escaped by UrlEncode() but needed to be escaped
value = value
    .Replace("(", "%28")
    .Replace(")", "%29")
    .Replace("$", "%24")
    .Replace("!", "%21")
    .Replace("*", "%2A")
    .Replace("'", "%27");

// these characters are escaped by UrlEncode() but will fail if unescaped!
value = value.Replace("%7E", "~");

return value;

}


#12

how to rediect after authentication using @anywhere? please help


#13

Hello. I have a same question about twitter oAuth2 authentication (I use twitter to authenticate users in my application): Can I customize different callbackUrls and select appropriate URL by param redirect_uri? I do not find any information about. Thank you.


#14

#15