Code Monkey home page Code Monkey logo

scribejava's Introduction

Welcome to the home of ScribeJava, the simple OAuth client Java lib!

Donate Maven Central

Why use ScribeJava?

Dead Simple

Who said OAuth/OAuth2 was difficult? Configuring ScribeJava is so easy your grandma can do it! check it out:

OAuthService service = new ServiceBuilder(YOUR_CLIENT_ID)
                                  .apiSecret(YOUR_CLIENT_SECRET)
                                  .build(LinkedInApi20.instance());

That single line (added newlines for readability) is the only thing you need to configure ScribeJava with LinkedIn's OAuth API for example.

Working executable examples are here Common usage: example

Threadsafe

Hit ScribeJava as hard and with many threads as you like.

Java 7 compatible

That's it. You can use it in old environments and in android apps. note: To compile from sources you will need Java 9 or newer

Async and other HTTP clients

ScribeJava support out-of-box several HTTP clients:

  • ning async http client 1.9.x (maven module scribejava-httpclient-ning) example
  • Async Http Client asynchttpclient 2.x (maven module scribejava-httpclient-ahc) example
  • OkHttp (maven module scribejava-httpclient-okhttp) example
  • Apache HttpComponents HttpClient (maven module scribejava-httpclient-apache) example
  • Armeria HTTP client (required >= java 8) example
  • any externally created HTTP client example

just add corresponding maven modules to your pom

Supports many flows and additional features

Supports all (50+) major 1.0a and 2.0 OAuth APIs out-of-the-box

Small and modular

ScribeJava's code is small (about 1k LOC) and simple to understand. No smart-ass or "clever" hacks here. You can use only 'core' or 'with apis' maven modules

Android-Ready

Works out of the box with android(TM) applications.

Stable & bulletproof

Good test coverage to keep you safe from harm.

When something bad actually happens, ScribeJava's meaningful error messages will tell you exactly what went wrong, when and where.

Pull it from Maven Central!

You can pull ScribeJava from the central maven repository, just add these to your pom.xml file:

<dependency>
    <groupId>com.github.scribejava</groupId>
    <artifactId>scribejava-apis</artifactId>
    <version>8.3.3</version>
</dependency>

And in case you need just core classes (that's it, without any external API (FB, VK, GitHub, Google etc) specific code), you could pull just 'core' artifact.

<dependency>
    <groupId>com.github.scribejava</groupId>
    <artifactId>scribejava-core</artifactId>
    <version>8.3.3</version>
</dependency>

How can I help ScribeJava

First of all, Pull Requests are welcome, the second option is donations.

When will ScribeJava support XXX (new RFC, custom functionality, new API etc.)

When you will send the pull request. That's the way for a majority of changes here. Or you can ask someone to make the paid job for you. In some cases, when I'm interested in changes (technically or financially), I can implement the request myself.

Paid consulting

If you or your business depends on the Scribejava and you need any specific improvement or new feature not currently implemented in the Scribejava, consider contacting me about a paid job.

Getting started in less than 2 minutes

Check the Getting Started page and start rocking! Please Read the FAQ before creating an issue :)

Some useful info and answers you can find on the wiki

Also, remember to read the fantastic tutorial that @akoskm wrote to easily integrate a server side app with an API (twitter in this case).

Questions?

Feel free to drop us an email or create issue right here on github.com

Forks

If you have a useful fork that should be listed there please contact us

scribejava's People

Contributors

alexgyori avatar arcao avatar arthraim avatar boncey avatar dhruvchandna avatar diegossilveira avatar dreamcwli avatar eranation avatar fernandezpablo85 avatar jochen-a-klein avatar joestazak avatar jpmeijers avatar kaushalmall avatar kullfar avatar matthewdlaudato avatar max904-github avatar mclaughlinsteve avatar michalfoksa avatar mnovy avatar muenzpraeger avatar norbertpotocki avatar ponyloky avatar rabrg avatar rbarbey avatar s-gromov avatar sidneyallen avatar sripathikrishnan avatar sschwieb avatar vainolo avatar vivin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

scribejava's Issues

Provide methods in Request class to set connection and read timeouts

Can you add public methods to the Request class so that connection and read timeouts can be set on the contained HttpURLConnection object? I see that you have a setTimeout() method but if I'm not mistaken, it can't be used properly as is. The "timeout" variable is acted upon in the constructor so by the time the setTimeout() method is called, it's already too late.

Effectively, I would like wrapper methods around HttpURLConnection's setConnectTimeout() and setReadTimeout() methods.

BTW - awesome library!

Yahoo example does not work

I ran yahoo example, and I got the following output

=== Yahoo's OAuth Workflow ===

Fetching the Request Token...
Got the Request Token!

Now go and authorize Scribe here:
https://api.login.yahoo.com/oauth/v2/request_auth?oauth_token=kbhmnpj
And paste the verifier here

3vytdb

Trading the Request Token for an Access Token...
Got the Access Token!
(if your curious it looks like this: Token[A=yChR7Q3ksAt95X5VHEVVSlA36mOuS3_qRBf0aH7AGALt0du_eTYLRCpQGlSwZKGYOXyAxqY_wafM1B8EZpoWbhTJSj3qmdICJDI13RY0uI6YCpRzrEigcHgGzbPT0kR3ofhq_TMNINt9_1NVdfKOj.y.vT0sSI8fc.5Psl5l0bbiRqm5TKTTFJVTKWR9Xt7J3UnI8vFo11SKDyLNIIbZMjSJPC3kU7.TqfI7cpNplVznk_EhJcwj6dZpT8y8XeKJe6nAhTNGAb0UaKWXp_ZcONEWyO2FF7tcGEuiK0zJVnX_A65M6nMc5ooT7_aZE0.to2E7jqwF5Gh.F0uGjpKul8oC7UFarktUGYsbRi5gSXrbGTLFUmk69cIglMXC7cKEpMSopktYQDDFbdNK6cioPLHyHq2BQSo8iNaf3WBfyi2krd21wcCi5FyykxyxjYl3SVh4LsSSJoMhM77OSzFU.0WhYNwbI9Ic6ri_4vi_HBaXVXOrQDeXfigoNynk2mZIFDAaRdpK62n5yOYSNkC.NLH.UpPpGPRMXQyR5wVL9kWI8t.nfc3GJaBWb1njia38J.YwPEocn6RhnJ_qRKsqEgYAzS6GkWCLdsxjADfTyhz.ElJisQczJ604hOblmLSJkgX3xrZUHsXaX.mhGU9Y1ELXcaJtvTR9j1NPQP3aJZ6GXh5GC14vPS9_VqAPS10wpCM5PMAf6wmx9LW5 , 5271609630d44e18f4338e49def993e89d365013] )

Now we're going to access a protected resource...
Got it! Lets see what we found...

204

Thats it man! Go and build something awesome with Scribe! :)

Thanks
Kwan

How to get User's GUID?

Pablo,

I've successfully implemented your library up to the point of authentication (I've got the accessToken). How do I get the logged-in user's GUID to make OAuthRequest calls? I'm new to OAuth, but I don't see anything in the Scribe API where I can actually get the user's GUID. Thanks,

-Dana

OAuth 2 Leg

Hi

I am looking for a java library supporting 2 legg oauth for our services.
Does Scribe support it ?
Thanks for your lights ;)

Patrick

FatSecret maybe the same issue as Google.

Hey guys, i see everyone is working hard to get this lib working fully.
I've been working all day long at getting a Token from FatSecret.

as Soon as I call Token requestToken = service.getRequestToken();

I get
11-23 13:59:49.744: ERROR/AndroidRuntime(25173): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.wwetools/com.wwetools.wwEtools}: org.scribe.exceptions.OAuthException: Response body is incorrect. Can't extract a token from this: 'Missing required parameter: oauth_consumer_key'

I can't seem to figure out why this param is missing. I noticed the invalid sig in another ticket with google, but the two problems could be related maybe. I don't know.. i'm definitely not an expert.

Here is where i am defining the service.

    service = new ServiceBuilder()
    .provider(org.scribe.builder.api.FatSecret.class)
    .apiKey(consumerKey)
    .apiSecret(consumerSecret)
    .build();    

The method service.getRequestToken(); get's called right after the above code.

Any help would be great.

Problem connecting to provider over SSL in Android client

I'm having trouble connecting to an Oauth provider over SSL. We've working on a project that implements an Oauth provider in a web site. When I run that provider web site locally, I am able to use Scribe in an Android app to perform the entire OAuth handshake. However, when I attempt to connect to the provider running on a server over SSL, Scribe fails to complete the handshake. The Response object returned in the request is empty. I've verified the provider code and android client code are the same.

While researching possible causes, I found an alternate OAuth client that implements the Apache HttpClient 4.x for use on Android. I've noticed that Scribe uses java.net.HttpURLConnection. The Signpost project page says there is a bug in Android's implementation and to avoid using it. I can't speak to the Android implementaiton, but swapping out the handshake code for signpost works on both localhost and over the ssl connection.

I am curious if you have seen this before. And also, are you considering an Apache HttpClient 4.x option in Scribe for Android? Thanks for your hard work on this library.

TokenExtractor BUG

the TokenExtractorImpl.java only extract the response token like "oauth_token=(\S_)&oauth_token_secret=(\S_?)(&(.))?".
how about "oauth_token_secret=(\S
)&oauth_token=(\S_?)(&(._))?"

Problem with LinkedInexample on 1.0.7 and 1.0.6

I changed the API key and apiKey with mine but cannot pass Line 37:
Verifier verifier = new Verifier(in.nextLine());
I'm on Ubuntu, java - 6- openjdk 64bits.
The console just writes:
=== LinkedIn's OAuth Workflow ===

Fetching the Request Token...
Got the Request Token!

Now go and authorize Scribe here:
https://api.linkedin.com/uas/oauth/authorize?oauth_token=xxxxxxxxxxxxx
And paste the verifier here

Also I tried to run all the other examples(twitter, yahoo...) without changing apikey and apisecret and they all stopped at L37.

What is the trick?

Hao

HttpProxy Issue

Hi,
I am new to scribe. I have the scribe example for Google and Yahoo working without a proxy. When I add the HTTPProxy either in the JVM Options or in the system.setProperty() I get following errors.

I separately tested my proxy connection by setting it and using URLConnection to connect to Yahoo and Google and it works. But it doesn't work with scribe. By the way I am using scribe version 1.1.0. Can you please help me with this?

For Google

Fetching the Request Token...
Exception in thread "main" java.lang.IllegalArgumentException: Response body is incorrect. Can't extract a token from an empty string
at org.scribe.utils.Preconditions.check(Preconditions.java:80)
at org.scribe.utils.Preconditions.checkEmptyString(Preconditions.java:40)
at org.scribe.extractors.TokenExtractorImpl.extract(TokenExtractorImpl.java:25)
at org.scribe.oauth.OAuth10aServiceImpl.getRequestToken(OAuth10aServiceImpl.java:42)
at org.scribe.examples.GoogleSample.main(GoogleSample.java:38)

For Yahoo

Fetching the Request Token...
Exception in thread "main" org.scribe.exceptions.OAuthException: Problems while creating connection
at org.scribe.model.Request.send(Request.java:58)
at org.scribe.model.OAuthRequest.send(OAuthRequest.java:12)
at org.scribe.oauth.OAuth10aServiceImpl.getRequestToken(OAuth10aServiceImpl.java:41)
at org.scribe.examples.YahooExample.main(YahooExample.java:35)
Caused by: java.net.UnknownHostException: api.login.yahoo.com
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:177)
at java.net.Socket.connect(Socket.java:519)
at java.net.Socket.connect(Socket.java:469)
at sun.net.NetworkClient.doConnect(NetworkClient.java:157)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
at sun.net.www.protocol.https.HttpsClient.(HttpsClient.java:271)
at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:328)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:172)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:729)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:158)
at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:832)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:230)
at org.scribe.model.Request.addBody(Request.java:92)
at org.scribe.model.Request.doSend(Request.java:77)
at org.scribe.model.Request.send(Request.java:55)

Thanks

1.1.0 depends on String.isEmpty()

01-31 15:23:06.816: ERROR/AndroidRuntime(9215): java.lang.NoSuchMethodError: java.lang.String.isEmpty
01-31 15:23:06.816: ERROR/AndroidRuntime(9215): at org.scribe.utils.URLUtils.appendParametersToQueryString(URLUtils.java:113)
01-31 15:23:06.816: ERROR/AndroidRuntime(9215): at org.scribe.model.Request.createConnection(Request.java:64)
01-31 15:23:06.816: ERROR/AndroidRuntime(9215): at org.scribe.model.Request.send(Request.java:54)
01-31 15:23:06.816: ERROR/AndroidRuntime(9215): at org.scribe.model.OAuthRequest.send(OAuthRequest.java:12)
01-31 15:23:06.816: ERROR/AndroidRuntime(9215): at org.scribe.oauth.OAuth10aServiceImpl.getRequestToken(OAuth10aServiceImpl.java:41)
01-31 15:23:06.816: ERROR/AndroidRuntime(9215): at com.ctoforaday.livefilm.AuthorizationService.onHandleIntent(AuthorizationService.java:39)
01-31 15:23:06.816: ERROR/AndroidRuntime(9215): at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:59)
01-31 15:23:06.816: ERROR/AndroidRuntime(9215): at android.os.Handler.dispatchMessage(Handler.java:99)
01-31 15:23:06.816: ERROR/AndroidRuntime(9215): at android.os.Looper.loop(Looper.java:123)
01-31 15:23:06.816: ERROR/AndroidRuntime(9215): at android.os.HandlerThread.run(HandlerThread.java:60)

Twitter getAccessToken problem

Hi, can you check this:
I've had permanent error on method getAccessToken():
W/System.err( 420): java.lang.IllegalArgumentException: Response body is incorrect. Can't extract a token from an empty string
W/System.err( 420): at org.scribe.utils.Preconditions.check(Preconditions.java:80)
W/System.err( 420): at org.scribe.utils.Preconditions.checkEmptyString(Preconditions.java:40)
W/System.err( 420): at org.scribe.extractors.TokenExtractorImpl.extract(TokenExtractorImpl.java:25)
W/System.err( 420): at org.scribe.oauth.OAuth10aServiceImpl.getAccessToken(OAuth10aServiceImpl.java:72)

I've been struggling with this error for 2 days, until has found that twitter4j is sending VERIFIER paramer in body. I have changed
//request.addOAuthParameter(OAuthConstants.VERIFIER, verifier.getValue());
to
request.addBodyParameter(OAuthConstants.VERIFIER, verifier.getValue());

and it finally it got working.

Can you check this out whether this is a bug?

Problems encoding space in URL parameters

This is mentioned on github.com/fernandezpablo85/scribe/issues - but holds true for the 1.1.x release as well.

Spaces aren't being correctly encoded; adding a space to a URL parameter results in a failed request.

(also, can that URL be set to forward, or a note be added to the github page? Half of google still points at the wrong source code.)

invalid_signature with Google

Trying to authenticate with Google. My code is:

OAuthService service = new ServiceBuilder().
    provider(GoogleApi.class).
    apiKey(OAUTH_CONSUMER_KEY).
    apiSecret(OAUTH_CONSUMER_SECRET).
    scope(CONTACTS_SCOPE).
    build();
Token requestToken = service.getRequestToken();
return AUTHORIZE_URL + requestToken.getToken();

The error I get is:

org.scribe.exceptions.OAuthException: Could not find request token or secret in response: signature_invalid

base_string:POST&https%3A%2F%2Fwww.google.com%2Faccounts%2FOAuthGetRequestToken&oauth_callback%3Doob%26oauth_consumer_key%3DmyKey%26oauth_nonce%3D553378635%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1289861432%26oauth_version%3D1.0%26scope%3Dhttps%253A%252F%252Fwww.google.com%252Fm8%252Ffeeds

at org.scribe.extractors.TokenExtractorImpl.extract(TokenExtractorImpl.java:35)
at org.scribe.oauth.OAuth10aServiceImpl.getRequestToken(OAuth10aServiceImpl.java:59)
at com.convio.addrbookimport.oauth.gmail.GmailOpenAuthAddressBookService.getOpenAuthConsentUrl(GmailOpenAuthAddressBookService.java:46)
at com.convio.addrbookimport.oauth.gmail.GmailOpenAuthAddressBookServiceFunctionalTest.testGetOpenAuthConsentUrl(GmailOpenAuthAddressBookServiceFunctionalTest.java:22)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.junit.internal.runners.TestMethod.invoke(TestMethod.java:59)
at org.junit.internal.runners.MethodRoadie.runTestMethod(MethodRoadie.java:98)
at org.junit.internal.runners.MethodRoadie$2.run(MethodRoadie.java:79)
at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:87)
at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

If I plug in the same key and secret into OAuth Playground (http://googlecodesamples.com/oauth_playground/index.php) it works.

scribe 1.0.4 problem with Api class version

Hi,

I've downloaded the 1.0.4 jar file and I am trying to build it with my application. However, I get the following error while building:
org/scribe/builder/api/Api.class: Error!: Invalid class file: Incorrect classfile version

Is there a problem with the Api class in this jar version?

Unable to login to facebook

Hi
I am able to authenticate but when I sign the URL I get an invalid access code error. From the documentation about the server side I guess I need to get access_code again . Can you update the Facebook example

it's not android ready

09-09 09:42:48.892: ERROR/dalvikvm(300): Could not find method java.lang.String.isEmpty, referenced from method org.scribe.utils.Preconditions.check
09-09 09:42:48.902: WARN/dalvikvm(300): VFY: unable to resolve virtual method 22: Ljava/lang/String;.isEmpty ()Z
09-09 09:42:48.902: WARN/dalvikvm(300): VFY: rejecting opcode 0x6e at 0x0006
09-09 09:42:48.902: WARN/dalvikvm(300): VFY: rejected Lorg/scribe/utils/Preconditions;.check (ZLjava/lang/String;)V
09-09 09:42:48.902: WARN/dalvikvm(300): Verifier rejected class Lorg/scribe/utils/Preconditions;
09-09 09:42:48.902: DEBUG/AndroidRuntime(300): Shutting down VM
09-09 09:42:48.902: WARN/dalvikvm(300): threadid=3: thread exiting with uncaught exception (group=0x4001aa28)
09-09 09:42:48.912: ERROR/AndroidRuntime(300): Uncaught handler: thread main exiting due to uncaught exception
09-09 09:42:48.922: ERROR/AndroidRuntime(300): java.lang.VerifyError: org.scribe.utils.Preconditions
09-09 09:42:48.922: ERROR/AndroidRuntime(300): at org.scribe.builder.ServiceBuilder.createApi(ServiceBuilder.java:43)
09-09 09:42:48.922: ERROR/AndroidRuntime(300): at org.scribe.builder.ServiceBuilder.provider(ServiceBuilder.java:37)

there is no isEmpty() method in java.lang.String class
trim().equals("") is fine.

Ability to change URLs of builder API

I'm developing mobile application, and particularly for facebook I need to change default AUTHORIZE_URL to more mobile friendly and with scope to enable "post to wall" feature.
I've not found any other way then hardcoding in FacebookApi string to
private static final String AUTHORIZE_URL = "https://m.facebook.com/dialog/oauth/authorize?display=touch&response_type=token&client_id=%s&redirect_uri=%s&scope=publish_stream";

How do you think, can you and should do such functionality?

Issue with Yahoo using scribe

Hi Pablo,

I am having some issue connection to yahoo using Scribe library. I keep getting error message which says "signature_invalid". since i am using scribe, I have no idea what the exact problem is. can you please help me get started with making requests to yahoo?

please refer to the link below where i have posted the details (request/response)

http://developer.yahoo.net/forum/index.php?showtopic=5378&amp;hl=scribe

any help would be greatly appreciated.

Thanks,

Zia

Allow custom callback urls

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

Twitter problem

I try to use OAuth with twitter but I'm always getting a 401 response at the:

org.scribe.model.Token accessToken = service.getAccessToken(requestToken, verifier);

It returns the "Cant extract a token from null object or an empty string." error from the extractor, but found out about the 401 response by debugging.

I am following your example and I'm using the number returned in the browser for the Verifier object.
Is this something with Twitter or is it a bug??

LinkedIn returns no result

=== LinkedIn's OAuth Workflow ===

Fetching the Request Token...
Got the Request Token!

Now go and authorize Scribe here:
https://api.linkedin.com/uas/oauth/authorize?oauth_token=3e26bf41-a5f4-4a76-a67f-63633770b122
And paste the verifier here

00543

Trading the Request Token for an Access Token...
Got the Access Token!
(if your curious it looks like this: Token[01191bd0-3825-49e8-98ef-06b367bd8302 , 66e58723-235c-4219-8fae-6c0e93cbdab4] )

Now we're going to access a protected resource...
Got it! Lets see what we found...

Thats it man! Go and build something awesome with Scribe! :)
Token[bb230d6e-faee-4ed3-bb7d-574be78ff297 , db86f572-59b4-4913-b0d5-f89071f1070a]

The xml body is empty

Undefined license

I want to use the library in an android application but because it's GPLed I must know that the license of scribe-java is compatible with GPL 2.0. Could you clarify the license of your library?

java.lang.NoSuchMethodError: java.lang.String.isEmpty when running on android

E/AndroidRuntime( 315): FATAL EXCEPTION: main
E/AndroidRuntime( 315): java.lang.NoSuchMethodError: java.lang.String.isEmpty
E/AndroidRuntime( 315): at org.scribe.utils.URLUtils.appendParametersToQueryString(URLUtils.java:113)
E/AndroidRuntime( 315): at org.scribe.model.Request.createConnection(Request.java:64)
E/AndroidRuntime( 315): at org.scribe.model.Request.send(Request.java:54)
E/AndroidRuntime( 315): at org.scribe.model.OAuthRequest.send(OAuthRequest.java:12)
E/AndroidRuntime( 315): at org.scribe.oauth.OAuth10aServiceImpl.getRequestToken(OAuth10aServiceImpl.java:41)

Maybe you should use lenght() menthod?

Allow custom callback urls

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

Revoke Tokens

It seems most service provider provide URL to "logout" or "revoke" access token.

It will be interesting to add a revokeAccessToken method that allows to manage the tokens life cycle.

Using String.isEmpty() results in error

Even though I'm using Java 6 in Android call to java.util.String results in error. It is used in your Preconditions.check() method. When I replaced it with error.trim().length() < 1 it worked. Or as you have just 20 lines above string.trim().equals("")

Using POST for LinkedIn returns 401

I'm trying to sign request as described in this doc (http://developer.linkedin.com/docs/DOC-1009) and I continuously get code 401 + empty body. Here's my code:
final OAuthRequest request = new OAuthRequest(Verb.POST, url);
request.addPayload(xmlPayload);
this.service.signRequest(this.accessToken, request);
request.send();

Do I need to encode XML load before adding? I'm also out of ideas as I trace it right where you call connection.connect(); (line 28 in Response.java) and everything seems to be added and signed.

Twitter callback does not work

I tried to use

OAuthService service = new ServiceBuilder()
.provider(TwitterApi.class)
.apiKey("6icbcAXyZx67r8uTAUM5Qw")
.apiSecret("SCCAdUUc6LXxiazxH3N0QfpNUvlUy84mZ2XZKiv39s")
.callback("http://71.141.110.10:8080/index.jsp")
.build();

Token requestToken = service.getRequestToken();

service.getRequestToken() returns

SEVERE: Servlet.service() for servlet jsp threw exception
org.scribe.exceptions.OAuthException: Could not find request token or secret in response:

/oauth/request_token
Desktop applications only support the oauth_callback value 'oob'

Eventhough, the example of guide
.callback("http://www.example.com/") has the same problem

Although I set "callback", this library understands that I would use "oob".

I need to use callback function to get user information automatically.
Thanks
Kwan

Google oauth with callback always fails with 'signature_invalid ...

I am using scribe 1.1.0 to oauth to google with managed account (non-anonymous)
When creating service without callback the access token is retrieved without problems if i am giving callback to the service the request fails in the 3rd leg:

Here is the trace:

org.scribe.exceptions.OAuthException: Response body is incorrect. Can't extract a token from this: 'signature_invalid
base_string:GET&https%3A%2F%2Fwww.google.com%2Faccounts%2FOAuthGetAccessToken&oauth_callback%3Dhttp%253A%252F%252F192.168.0.162%253A8080%252Foauth%26oauth_consumer_key%3Dtalkmail.com%26oauth_nonce%3D889555216%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp%3D1295358188%26oauth_token%3D4%252FIU7kuhQiRSzOebHlULa30N1DC7PD%26oauth_verifier%3DVXwkVw%252BHzlv%252F0tf0R0VsREGW%26oauth_version%3D1.0%26scope%3Dhttps%253A%252F%252Fwww.google.com%252Fm8%252Ffeeds%252F

'
at org.scribe.extractors.TokenExtractorImpl.extract(TokenExtractorImpl.java:35) ~[scribe-1.1.0.jar:na]
at org.scribe.oauth.OAuth10aServiceImpl.getAccessToken(OAuth10aServiceImpl.java:68) ~[scribe-1.1.0.jar:na]
at com.mailvision.talkmail.actors.TalkMailSignupActor.verify(TalkMailSignupActor.java:70) ~[deploy/:na]

Using duplicate parameters to signed URL results in error

On LinkedIn when I try to sign and execute updates URL everything works until I attempt to use multiple GET parameters by the same key. For example the following URLs work individually:

http://api.linkedin.com/v1/people/~/network/updates
http://api.linkedin.com/v1/people/~/network/updates?type=CONN
http://api.linkedin.com/v1/people/~/network/updates?type=STAT

but this one results in error

http://api.linkedin.com/v1/people/~/network/updates?type=CONN&type=STAT

And the error returned is
IOException:Received authentication challenge is null

According to this discussion http://is.gd/f4DYZ this happens because the URL is not properly encoded, but it also may be an issue of duplicate keys

RedirectURL usage at Twitter and common-lang issue

This is really nice tool.
But, I need your help.
common-lang is not required common-codec.jar file is required.
Please, modify your quick guide.
Also, I need to use redirectURL for twitter.
Please, let me know how I could do it.
Thanks
Kwan

Got signature invalid error with Yahoo

I tried the Yahoo example, and was able to get access token just fine, but then it gave the following error in the response.

401

<yahoo:error xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" yahoo:uri="http://yahoo.com" xml:lang="en-US">
yahoo:descriptionPlease provide valid credentials. OAuth oauth_problem="OST_OAUTH_SIGNATURE_INVALID_ERROR",realm="yahooapis.com"/yahoo:description
yahoo:detailPlease provide valid credentials. OAuth oauth_problem="OST_OAUTH_SIGNATURE_INVALID_ERROR", realm="yahooapis.com"/yahoo:detail
/yahoo:error

Error building project

FYI I've very little experience with maven so maybe I am missing something really basic here. When I run "mvn package" from the downloaded code I get this error:

[INFO] Error building POM (may not be this project's POM).

Project ID: org.scribe:scribe:jar:1.0.9

Reason: Cannot find parent: org.sonatype.oss:oss-parent for project: org.scribe:scribe:jar:1.0.9 for project org.scribe:scribe:jar:1.0.9

How do I fix this problem? Thanks.

Google Support

I just tried to use google by this library.
Google needs to have scope parameter to have request token but Google API does not have it.
Also, google oauth is 3 legged process -request token, authorized token and access token.
I hope that I will get GoogleExample.java in the example folder.
Thanks
Kwan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.