on ‎2018 Mar 08 5:42 PM
Hello,
I am a trial user developing a demo iOS app using SAP Cloud Platform SDK for iOS Assistant. Searching SAP API Business Hub for SF API, I was able to create several mobile native apps using connections/destinations to various SF API endpoints. Using the iOS Assistant specifying existing connections mostly work but I'm running into a reproducible 502 error after supplying onboarding credentials for one particular API. I let the assistant generate a master/detail app using the following connection:
Success Factors User Management (User, UserPermissions)
https://sandbox.api.sap.com/successfactors/odata/v2/User
The app is not using authentication only specifying APIKey in request header. I have successfully tested this API in Discovery API tools in browser as well as Postman and Curl so I know it works. The iOS Assistant is able to generate an Xcode project using a destination with the above URL. App compiles and executed on iOS Simulator while displaying the on-boarding and authentication screens. After entering correct credentials, the response returns with a 502 error stating authentication failed and to check authentication URL and authenticator used. To note, the destination/connector configuration is identical to others I have configured for additional endpoints and it is not clear in the logs why this one fails. Here is a screenshot of the error on iOS simulator.

Any help is appreciated.
Request clarification before answering.
Brian,I tried reproducing this with the Assistant and creating a new app with an SAP API Business Hub endpoint. I'm not seeing exactly the same thing, but also a failed onboarding flow because apparently the backend doesn't respond with a service catalog at the root URL. The problem is that the onboarding flow tries to connect to a backend URL to validate that the authentication was actually successful, and default to the service root - as you can see in your error message. What helped in my case was that I configured the OnboardingManager.swift in the generated app to use a different URL to validate the authentication
let discoveryConfigurationTransformer = DiscoveryServiceConfigurationTransformer(applicationID: "com.martiancraft.sap.user.mcorg", authenticationPath: "com.martiancraft.sap.user.mcorg")
try change this to
let discoveryConfigurationTransformer = DiscoveryServiceConfigurationTransformer(applicationID: "com.martiancraft.sap.user.mcorg", authenticationPath: "com.martiancraft.sap.user.mcorg/$metadata")
at least for me that did the trick
Thanks
Andreas
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Andreas,
Thank you for getting back so quickly.
Your solution worked in that I got past the authentication and into the app. By appending "/$metadata" to the authenticationPath during instantiating the DiscoveryServiceConfigurationTransformer resolved the service root and got past the authentication.
However, I want to point out that it caused another downstream server error (501) immediately after authenticating which I was able to resolve by hacking the `configureOData(_ urlSession: SAPURLSession, _ serviceRoot: URL)` method in AppDelegate. Essentially, The "$metadata" path had to be removed from the serviceRoot during the instantiation of the OnlineODataProvider. Here is the method. You will notice the `deleteLastPathComponent()`
```
// MARK: - Configure OData
private func configureOData(_ urlSession: SAPURLSession, _ serviceRoot: URL) {
var newServiceRoot: URL = serviceRoot
newServiceRoot.deleteLastPathComponent()
let odataProvider = OnlineODataProvider(serviceName: "EntityContainer", serviceRoot: newServiceRoot, sapURLSession: urlSession)
// Disables version validation of the backend OData service
// TODO: Should only be used in demo and test applications
odataProvider.serviceOptions.checkVersion = false
self.entityContainer = EntityContainer(provider: odataProvider)
// To update entity force to use X-HTTP-Method header self.entityContainer.provider.networkOptions.tunneledMethods.append("MERGE")
}
```
| User | Count |
|---|---|
| 8 | |
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.