Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom callback urls #16

Closed
shayerov opened this issue Oct 3, 2010 · 6 comments
Closed

Allow custom callback urls #16

shayerov opened this issue Oct 3, 2010 · 6 comments

Comments

@shayerov
Copy link

shayerov commented Oct 3, 2010

Hi
Today the package only allows callback urls if their scheme is http or https.
I'm developing an Android app and as part of my app I need to use custom scheme urls such as <my_scheme>://<service_name> , but when I try to do that through scribe-java I get an error that my callback url is not supported.
I went through the code and this is not a big change, I'd love to see it in v1.0.4, I Can also send you the patch for it if needed.

Thanks!
Shay

@fernandezpablo85
Copy link
Collaborator

Shay,

Working on it right now

@shayerov
Copy link
Author

shayerov commented Oct 7, 2010

Thanks!
If you're interested, what I did, is just made sure it's a valid URI rather than URL, and that fixed everything I needed.
Great package by the way! :)

Shay

@fernandezpablo85
Copy link
Collaborator

Cool.

What I changed is this:

http://gist.github.com/616146

Let me know what you think about it

@shayerov
Copy link
Author

shayerov commented Oct 8, 2010

Looks cool...
I did

static boolean isUrl(String url)
{
try {
new URI(url);
} catch (URISyntaxException e) {
return false;
}
return true;
// return url.startsWith("http://") || url.startsWith("https://");
}

I'm not sure performance wise what is better, regex or using try/catch, but I think both will work equally good, and since it's only once per service, it's not that bad anyway.

Thanks again

@fernandezpablo85
Copy link
Collaborator

Cool.

I kinda have a weakness for regexes, and don't like the try catch blocks a lot so I think I'll leave as it is for now...

You have the fix on 1.0.4 released just now.

sorry for the delay I've been working my ass of lately :)

@shayerov
Copy link
Author

shayerov commented Oct 8, 2010

I know your point of view... I love regexes as well...
Anyway, thanks! I'll let you know if I find more things in the package....

btw - are you thinking about integrating with OAuth 2.0 ? (What Facebook is using...), it's almost the same as OAuth 1, but with some minor changes

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants