mckracken
asked this on June 07, 2011 19:59
Hi again. Now i'm my LayarPlayer working, but the layer i try to access is protected by a login procedure (i'm the owner). If i use layar in android and try to open that layer, it shows me the login request. Here, on the iPhone, it loads the layarplayer, then shows nothing, with this message:
Response error 1 in layer details request: OAuth validation failed
This is the JSON response i get (i catch it from the browser, pasting the request the layarplayer does):
{
"hotspots": [],
"layer": "mylayername",
"errorString": "Layer not found, removed, or inaccessible",
"morePages": false,
"errorCode": 10,
"nextPageKey": null,
"responseMessage": "Layer not found, removed, or inaccessible",
"responseCode": 10
}
I think i have to login with layarplayer, or something similar. How?
Thank you
Comments latest first
Ok, Valery, thank you for your help! Now it works, but the error wasn't in that line of code. It was the same, but on this line:
NSDictionary *oauthParameters = [NSDictionary dictionaryWithObject:oauthValues forKey:oauthKeys];
I had to use dictionaryWithObjects:forKeys, with the plural. I see now in the documentation that also the other line is with the plural, but, just fort knowledge, the incriminated line is this one.
Thank you very much!
If yes then look here
your code:
NSDictionary *layerFilters = [NSDictionary dictionaryWithObject:layerValues forKey:layerKeys];misprint? (forKeys)
strange.. tried using your layer in my PlayerBasedApp - works fine.. no oauth issues
about peace of code you posted earlier - this was direct paste from Xcode?
Oh, this last coment it's me!!!
Ok, i'll try to post something new...
This is the request the layarplayer sends to the layar server:
http://dev.layar.com/api/layer/detail/tamtamsv/?countryCode=IT&...
phoneId is hidden to you.
So...i noticed that in the get request there is oauth_consumer_key set to "iphone30". Is this right? That's not my consumer_key. Why is set that way? Could be this the problem? thank you
Then, i'm understanding that this issue is a bit complicate. I read a lot the layar documentation, and i found a probable reason for this problem. So, i'm just asking you if this could be true:
The problem is the OAuth autentication, so is it possible that the server hosting the POIs isn't able to generate the proper OAuth key?
Something like this:
myApp launch the layarPayer
layarPlayar contatc Layar and pass the consumer and the secret
Layar contat the server with the POIs and pass the consumer and the secret
The server with the POIs isn't able to generate the proper OAuthKey, but respond to Layar with all other informations
Layar doesn't find the proper OAuthKey in the response, and say to the layarPlayer that the authentication failed.
Is it so? And, if this is so, do you have some PHP example to generate OAuthKey in the server and pass it to layar?
Thank you
Then, is possible that there is no solution for this issue? Here is my initialization code (it's from the documentation):
NSString *layerName = @"akamatest";
NSString *consumerKey = @"myconsumer"; //placeholder
NSString *consumerSecret = @"mysecret"; //placeholder
NSArray *oauthKeys = [NSArray arrayWithObjects:LPConsumerKeyParameterKey, LPConsumerSecretParameterKey, nil];
NSArray *oauthValues = [NSArray arrayWithObjects:consumerKey, consumerSecret, nil];
NSDictionary *oauthParameters = [NSDictionary dictionaryWithObject:oauthValues forKey:oauthKeys];
NSArray *layerKeys = [NSArray arrayWithObject:@"radius"];
NSArray *layerValues = [NSArray arrayWithObject:@"1000"];
NSDictionary *layerFilters = [NSDictionary dictionaryWithObject:layerValues forKey:layerKeys];
LPAugmentedRealityViewController *augmentedRealityViewController = [[[LPAugmentedRealityViewController alloc] init] autorelease];
augmentedRealityViewController.delegate = self;
[self presentModalViewController:augmentedRealityViewController animated:YES];
[locationController.locationManager stopUpdatingLocation];
[augmentedRealityViewController loadLayerWithName:layerName oauthParameters:oauthParameters layerFilters:layerFilters options:LPMapViewDisabled | LPListViewDisabled];
This is driving me crazy, please help...
The issue is: this layer is in "test mode", so it need the user to be logged as the layar owner. Is possible to pass this login to the player from the application?
If i open the layer with layar, i need to go to information -> login with layar account.
I think that when this layer will be "test mode" no longer, i will not need to do this login procedure... (i hope), but now i need to test it. How
what about oauth keys?
I changed the layername in this post. I put "mylayername" as a placeholder :D. In the real response, there is the real name (at this point, it's "akamatest").
I already have the cookies for the getPOIs action (i perform it with success). Do I need cookies for the layer account?