Closed shaharukhs closed 7 years ago
Hi @shaharukhs could you provide some more information on how you are getting this error?
What version of the SDK are you using? How are you initiating the login? Via the LoginButton? Via a stand alone LoginManager? Or through the RideRequestView?
It sounds like you are requesting a privileged scope (like request
) which requires you to have a server set up to handle Authorization Code Grant for login. Is that what you want, or do you want the app to redirect to the App Store to install Uber?
Thank you @jbrophy17 for reply
here is my code
NSArray<UBSDKRidesScope *> *scopes = @[UBSDKRidesScope.Profile, UBSDKRidesScope.Places, UBSDKRidesScope.Request];
_loginManager = [[UBSDKLoginManager alloc] initWithLoginType:UBSDKLoginTypeNative];
loginButton = [[UBSDKLoginButton alloc] initWithFrame:CGRectZero scopes:scopes loginManager:_loginManager];
loginButton.presentingViewController = self;
[loginButton sizeToFit];
loginButton.delegate = self;
[self.view addSubview:loginButton];
loginButton.center = self.view.center;
#pragma mark - UBSDKLoginButtonDelegate
- (void)loginButton:(UBSDKLoginButton *)button didLogoutWithSuccess:(BOOL)success {
// success is true if logout succeeded, false otherwise
if (success) {
[self _showMessage:@"Logout"];
}
}
- (void)loginButton:(UBSDKLoginButton *)button didCompleteLoginWithToken:(UBSDKAccessToken *)accessToken error:(NSError *)error {
if (accessToken) {
[self _showMessage:@"Saved access token!"];
} else if (error) {
// An error occured
[self _showMessage:error.localizedDescription];
}
}
and I am disable setFallBackEnabled
so i don't want then to redirect to App Store.
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
// If true, all requests will hit the sandbox, useful for testing
[UBSDKConfiguration setSandboxEnabled:YES];
// If true, Native login will try and fallback to using Authorization Code Grant login (for privileged scopes). Otherwise will redirect to App store
// [UBSDKConfiguration setFallbackEnabled:NO];
return YES;
}
Now what I want is if Uber app is not installed then implicit login called but after login it ask me for permission, So when I allow it return back Error as I previously told.
Now I am using http://login.uber.com/oauth/v2/authorize?client_id=
But don't know why I am not able to login with UBSDKLoginTypeImplicit one. What I am doing wrong?
Sorry for the delay! Thanks for providing your code & some additional context. It sounds like the problem is that you want to fall back to Implicit
when the app isn't installed. Unfortunately, since you are requesting the UBSDKRidesScope.Request
scope (which is a privileged scope) you are required to either use Native or Authorization Code Grant for getting an access token.
To use Authorization Code Grant, you will need to specify an additional callback URI. Much like how you added Native
and General
callback URIs, you will need to specify an AuthorizationCode
one as well that points to your server that can handle the token exchange.
Thank you for reply.
I have implicated Implicit like this as per documentation,
UBSDKLoginManager *loginManager = [[UBSDKLoginManager alloc] initWithLoginType:UBSDKLoginTypeImplicit];
[loginManager loginWithRequestedScopes:@[ UBSDKRidesScope.RideWidgets ] presentingViewController: self completion: ^(UBSDKAccessToken * _Nullable accessToken, NSError * _Nullable error) {
// Completion block. If accessToken is non-nil, you're good to go
// Otherwise, error.code corresponds to the RidesAuthenticationErrorType that occured
if (error) {
NSLog(@"%@", error.localizedDescription);
// Handle error
[self _showMessage:error.localizedDescription];
return;
} else {
[self _showMessage:@"Saved access token!"];
}
}];
loginWithRequestedScopes:@[ UBSDKRidesScope.RideWidgets ]
if I used this scopes it works fine but when I tried to use loginWithRequestedScopes:@[UBSDKRidesScope.Profile, UBSDKRidesScope.Places, UBSDKRidesScope.Request]
then it return error.
Its not issue now for me just want to know why.
You can close this thread as my problem is solved.
Gets the address assigned as the "home" address for current user
[self.ridesClient fetchPlace:UBSDKPlace.Home completion:^(UBSDKPlace * _Nullable place, UBSDKResponse *response) {
NSLog(@"user home address :: %@",place.address);
}];
where I can get address for Home/Work location like this place.address
but how can I retrieve Coordinates for users Home/Work locations.
The reason you can't get the .Request
scope is because it is a priveleged scope, s you are required to use either Single Sign On or Authorization Code Grant. Implicit grant can only grant privileged scopes. Please read https://developer.uber.com/docs/riders/guides/scopes for more information.
As for the lat/long of the Home/Work locations, that is currently not provided via the API
I am developing one app which allow to book uber from my app but I done everything as official documents
My code is working fine for Native/SSO Login but If uber app is not installed then it opens in app web browser to login Uber but after entering credential I get error
my info.plist is as follow
stackoverflow link for this question