uber / uber-ios-sdk

Uber iOS SDK (beta)
https://developer.uber.com/docs
MIT License
376 stars 125 forks source link

Privileged scopes are not accessible for .login and .implict #192

Open sujeshraveendran opened 7 years ago

sujeshraveendran commented 7 years ago

Privileged scopes not accessible. The API documentation states that "During development, your account and any five developer accounts you list on the dashboard will be able to authorize these [privileged] scopes without whitelisting." But here i'm unable to use the "request" scope in sanbox and production with UBER SDK loginManager class. I tried all the three options .native .implicit and .authorizationCode on loginManager (let loginManager = LoginManager(loginType: .native). #1 When i try with .native and .authorizationCode i'm getting "An Unknown Error Occured" message ie error is NIL object . when i try with .implicit i'm getting "Server was unable to understand your request" (error NSError? domain: "com.uber.rides-ios-sdk.ridesAuthenticationError" - code: 13 0x0000600000448700). When i remove .request scope and getting accessToken as expected but when i try to call riderequest( ridesClient.requestRide) with this bearerToken i'm getting error status code 401 (title String? "This endpoint requires at least one of the following scopes: request.delegate.tosaccept, request, request.delegate" some). `` // LoginManager login function @IBAction func login( sender: AnyObject) { // Define which scopes we're requesting // Need to be authorized on your developer dashboard at developer.uber.com let requestedScopes = [RidesScope.profile, RidesScope.request] // Use your loginManager to login with the requested scopes, viewcontroller to present over, and completion block let loginManager = LoginManager(loginType: .native)

loginManager.login(requestedScopes: requestedScopes, presentingViewController: self) { (accessToken, error) -> () in
    if accessToken != nil {
        //Success! AccessToken is automatically saved in keychain
        self.showMessage("Got an AccessToken!")
        print(accessToken?.tokenString ?? "")
      //  let accessTokenString = "access_token_string"
       // let token = AccessToken(tokenString: accessTokenString)
       // print(token.tokenString ?? "")
        if TokenManager.save(accessToken: accessToken!){
            // Success
             self.showMessage("Token Saved!")
        } else {
              self.showMessage("unable to Saved!")
            // Unable to save
        }

        let token1 =      TokenManager.fetchToken()
         print(token1?.tokenString ?? "")

        self.getData()

    } else {
        // Error
        if let error = error {
            self.showMessage(error.localizedDescription)
        } else {
            self.showMessage("An Unknown Error Occured")
        }
    }
}

} // **** ridesClient.requestRide function**** func requestRide() {

// Create ride parameters

// self.requestButton.isEnabled = false let pickupLocation = CLLocation(latitude: 10.0080, longitude: 76.3623) let dropoffLocation = CLLocation(latitude: 10.0159, longitude: 76.3419) // let pickupLocation = CLLocation(latitude: 37.787654, longitude: -122.402760) // let dropoffLocation = CLLocation(latitude: 37.775200, longitude: -122.417587)

let builder = RideParametersBuilder()
builder.pickupLocation = pickupLocation
builder.pickupNickname = "Infopark campus"
builder.dropoffLocation = dropoffLocation
builder.dropoffNickname = "Kakkanad"

// builder.productID = "a1111c8c-c720-46c3-8534-2fcdd730040d"

// Use the POST /v1/requests endpoint to make a ride request (in sandbox)
ridesClient.requestRide(parameters: builder.build(), completion: { ride, response in
    DispatchQueue.main.async(execute: {
        self.checkError(response)
        if let ride = ride {
            self.statusLabel.text = "Processing"

            self.updateRideStatus(ride.requestID, index: 0)
        } else {
            //self.requestButton.isEnabled = true
        }
    })
})

} scrn1

edjiang commented 7 years ago

That's interesting. I'll have to look into this more. Can you please confirm that the Uber Application owner is the same as what you're using inside your own app? You can check the "Developers" tab in the admin console.

sujeshraveendran commented 6 years ago

Yes ! Both are same! Tried to login with different developer too.

isaacraja15 commented 5 years ago

Did you get any solution ?