Evernote / evernote-sdk-android

Evernote SDK for Android
428 stars 168 forks source link

Signature for EvernoteAuthToken(String, String, String, String, int, String) #1

Closed kyleparker closed 12 years ago

kyleparker commented 12 years ago

In an attempt to make modifications to the source code for the OAuth client, I think I might have ran into a problem with the com.evernote.client.oauth.AccessTokenExtractor class.

When I attempt to compile the src, I get the following error:

The constructor EvernoteAuthToken(String, String, String, String, int, String) is undefined.

This is the offending code block:

public Token extract(String response) { Preconditions.checkEmptyString(response, "Response body is incorrect. " + "Can't extract a token from an empty string"); return new EvernoteAuthToken(extract(response, TOKEN_REGEX), extract(response, SECRET_REGEX), extract(response, NOTESTORE_REGEX), extract(response, WEBAPI_REGEX), Integer.parseInt(extract(response, USERID_REGEX)), response); }

The only constructor in the EvernoteAuthToken class is:

public EvernoteAuthToken(Token token)

Did I miss something when pulling in the original source?

kyleparker commented 12 years ago

BTW, the previous version of the source code had this constructor in the EvernoteAuthToken class:

public EvernoteAuthToken(String token, String secret, String noteStoreUrl, String webApiUrlPrefix, int userId, String rawResponse) { super(token, secret, rawResponse); this.noteStoreUrl = noteStoreUrl; this.webApiUrlPrefix = webApiUrlPrefix; this.userId = userId; }

Current version of the EvernoteAuthToken class has this constructor:

public EvernoteAuthToken(Token token) { super(token.getToken(), token.getSecret(), token.getRawResponse()); this.noteStoreUrl = extract(getRawResponse(), NOTESTORE_REGEX); this.webApiUrlPrefix = extract(getRawResponse(), WEBAPI_REGEX); this.userId = Integer.parseInt(extract(getRawResponse(), USERID_REGEX)); }

sethhitch commented 12 years ago

Thanks for catching this. We pushed most of the OAuth functionality back into the Scribe OAuth library that we're using, but I forgot to remove it from the source here. I just deleted the unused (and broken) classes, that should resolve the issue.

kyleparker commented 12 years ago

Thanks! Works perfectly now.

Kyle On May 4, 2012 12:34 PM, "Seth Hitchings" < reply@reply.github.com> wrote:

Thanks for catching this. We pushed most of the OAuth functionality back into the Scribe OAuth library that we're using, but I forgot to remove it from the source here. I just deleted the unused (and broken) classes, that should resolve the issue.


Reply to this email directly or view it on GitHub:

https://github.com/evernote/evernote-sdk-android/issues/1#issuecomment-5514522

kyleparker commented 12 years ago

Seth,

This is in reply to the Null Authentication token from Android SDK thread on the forum...I've tried to push my changes up to GitHub (I was able to fork the original, but didn't make it much further). Apparently I'm not smart enough to figure it out :) I guess too many late hours trying to get my app finished in time for the Devcup Challenge!

Anyway, I've attached the two files that I personally changed - I may have butchered it a bit and made some unncessary additions, but I didn't see the obvious way to get to the data I was looking for.

Specifically, in EvernoteSession, I added a createUserStore method to mimic createNoteStore. Also added getUserId, getNoteStoreUrl and getWebApiUrlPrefix so I could access them at the same time I got the AuthToken.

In the EvernoteOAuthActivity, I attempted to change that to a webview, which worked fine on pre-ICS devices, but crashed on ICS (Galaxy Nexus). I posted something to the forum with more details, but haven't had a chance to dig into it any further.

Sorry for using this method of sending the code - I've not used GitHub before and was unable to commit my changes to my fork.

Kyle

On Fri, May 4, 2012 at 12:49 PM, Kyle Parker kyleparker23@gmail.com wrote:

Thanks! Works perfectly now.

Kyle On May 4, 2012 12:34 PM, "Seth Hitchings" < reply@reply.github.com> wrote:

Thanks for catching this. We pushed most of the OAuth functionality back into the Scribe OAuth library that we're using, but I forgot to remove it from the source here. I just deleted the unused (and broken) classes, that should resolve the issue.


Reply to this email directly or view it on GitHub:

https://github.com/evernote/evernote-sdk-android/issues/1#issuecomment-5514522