---, I'm trying to get started by first using Poster with the V2
spec. However, I am not able to do the first step, which I believe is
to get a token. Here is my URL in Poster:
(Note that I substitute xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-xxxx for my
developer key)
When I click the Get button, I get a 401 Unauthorized error. I got the
timestamp from http://www.unixtimestamp.com/index.php which should
give me the right unix value.
I found the instructions on using Poster, but its for the V1 spec.
Thanks,
-Gregg Reno
My guess is that you don't yet have a Production System developer key, so the developer key you have would be valid on the Reference System only.
The URL you would use for the Reference System would be:
Everything else in your request looks correct.
--
Jimmy
> To unsubscribe from this group, send email to fs-android+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.
NOTICE: This email message is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
Michael
________________________________________
From: fs-an...@googlegroups.com [fs-an...@googlegroups.com] On Behalf Of Jimmy Zimmerman [Zimme...@familysearch.org]
Sent: Tuesday, March 23, 2010 12:37 PM
To: fs-an...@googlegroups.com
Subject: Re: Poster and Identity v1
No Android specific sample code that I know of yet. There is Java code for all of the serializing/parsing stuff. I believe it is to be used with the Jersey client library. Would this work with Android?
https://devnet.familysearch.org/downloads/sample-code/sample-clients
We should start a project for sample code. Anyone want to start a project on Google Code? Or somewhere else? My Ruby library is out on Github.com<http://Github.com>, but I don't know if that's where Android/Java developers hang out.
--
Jimmy
On Mar 23, 2010, at 12:10 PM, Gregg Reno wrote:
Thanks Jimmy - that worked. I had been using the www.dev.usys.org<http://www.dev.usys.org/> link previously, but somehow pasted the production link in by mistake.
Two other questions for you:
* My timestamp was rejected, but the server gave me a correct range to use. After using a number in that range, it worked. Maybe this site http://www.unixtimestamp.com/index.php has it's clock set differently than the reference system server? If so, do I need to somehow compensate for the time difference?
* Is there any Android source code I can use as a starting point? Just looking for something basic like the authentication and a name lookup. It would save some time.
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Am I correct in assuming that the only way to authenticate is to show the user a web page and have them type in their username and password? I would rather store that for them in a preference file and log them in automatically.
Also, I get to the point where the username and password screen is displayed. If I enter my "api-user-2120" user id and password, I get a message "The session has timed out or is invalid. Unable to continue authentication". But if I put in a bogus username and password, I get "the username or password is incorrect". Any ideas?
private void GetConsumerToken()I successfully get my consumer token and secret token, then call this, which is where my problem is:
{
String url = serverName + IDENTITY_REQUEST_TOKEN;
String sTimestamp = String.valueOf(System.currentTimeMillis() / 1000);
HttpClient httpclient = new DefaultHttpClient();
// Prepare a request object
HttpGet httpget = new HttpGet("http://www.dev.usys.org/identity/v2/request_token?oauth_consumer_key=(my dev key here)&oauth_nonce=123456789&oauth_signature_method=PLAINTEXT&oauth_signature=%26&agent=Android&oauth_timestamp=" + sTimestamp);
HttpPost httppost = new HttpPost(url);
// Execute the request
HttpResponse response;
try {
response = httpclient.execute(httpget);
// Examine the response status
DebugMsg("status = " + response.getStatusLine().toString());
// Get hold of the response entity
HttpEntity entity = response.getEntity();
// If the response does not enclose an entity, there is no need
// to worry about connection release
if (entity != null) {
// A Simple JSON Response Read
InputStream instream = entity.getContent();
String result= convertStreamToString(instream);
DebugMsg("Result =" + result);
oauthConsumerToken = result.substring(result.indexOf("oauth_token=") + 12);
oauthConsumerToken = oauthConsumerToken.substring(0, oauthConsumerToken.indexOf("&"));
oauthTokenSecret = result.substring(result.indexOf("oauth_token_secret=") + 19);
oauthTokenSecret = oauthTokenSecret.substring(0, oauthTokenSecret.indexOf("&"));
}
}
OAuthAccessor defaultClient() {
String callbackUrl = "reno-familysearch:///";
OAuthServiceProvider provider = defaultProvider();
OAuthConsumer consumer = new OAuthConsumer(callbackUrl, oauthConsumerToken, oauthTokenSecret, provider);
OAuthAccessor accessor = new OAuthAccessor(consumer);
OAuthClient client = new OAuthClient(new HttpClient4());
return accessor;
}