cancel
Showing results for 
Search instead for 
Did you mean: 

Enabling discovery service

01-25-2022 12:12 PM
perage Participant
1164 views 2 comments Go to solution
0 Likes
SAP Managed Tags
Subscribe

Hi,

I've tried to enable discovery service for one of our apps, but doesn't get it to work 😞 I've read most of the documentation for SCPms, but most seems somewhat outdated
(e.g this guide instructs to "publish to discovery service, but this is not an option in ms)

What I've done:

1. Added BTPms TXT file to our DNS to verify the domain.

2. Added the domain to BTP and added domain to app

3. Set .discoveryService as configurationOptions

    private func configuredWelcomeScreenStep() -> WelcomeScreenStep {
        let appParameters = FileConfigurationProvider("AppParameters").provideConfiguration().configuration
        let destinations = appParameters["Destinations"] as! NSDictionary
        let discoveryConfigurationTransformer = DiscoveryServiceConfigurationTransformer(applicationID: appParameters["Application Identifier"] as? String, authenticationPath: destinations["Count"] as? String)
        let welcomeScreenStep = WelcomeScreenStep(transformer: discoveryConfigurationTransformer, provider[JSONConfigurationProvider()])<br>

        welcomeScreenStep.welcomeScreenCustomizationHandler = { welcomeStepUI in
            welcomeStepUI.headlineLabel.text = LocalizedStrings.Onboarding.headlineLabel
            welcomeStepUI.detailLabel.text = LocalizedStrings.Onboarding.detailLabel
            welcomeStepUI.primaryActionButton.titleLabel?.text = LocalizedStrings.Onboarding.primaryActionButton

            if let welcomeScreen = welcomeStepUI as? FUIWelcomeScreen {
                welcomeScreen.configurationOptions = .discoveryService
            }
        }

        return welcomeScreenStep
    }<br>

Issue

When adding e-mail used to log in with Oauth2 nothing happens from the UI, and the debugger only reports

2022-01-25 12:01:30.213413+0100 Count[51958:1673694] [general] # SAP.Flows.Onboarding.Steps.WelcomeScreenOnboarding - DEBUG - (Main) - WelcomeScreenStep.swift.welcomeController(_:shouldTryUserEmail:) - 354 - Called: welcomeController shouldTryUserEmail<br>

Any clues?

On a side note; The email with a link - is this something BTP can provide?

0 Likes

Accepted Solutions (1)

Accepted Solutions (1)

MarcoEidinger
Product and Topic Expert
Product and Topic Expert
0 Likes

Hi Per,

please use DiscoveryServiceConfigurationProvider instead of JSONConfigurationProvider

The initializer expects:

  • applicationID: App identifier to use for web requests to the Discovery Service. If no value is supplied, the calling app’s CFBundleIdentifier value will be obtained at runtime. This parameter allows for obtaining configuration data for a different app than the caller.
  • discoveryServiceHost: Discovery Service Host parameter used for storing custom discoveryServiceHost url. This url is used to obtain data from SAP Discovery Service. If no value is supplied, default Discovery Service Host is obtained from function discoveryServiceHostnameFor(_:).

Example

let discoveryServiceConfigProvider = DiscoveryServiceConfigurationProvider(applicationID: "piat.hapi.oauth.sample", discoveryServiceHost: "service-discovery-hub-development.cfapps.eu10.hana.ondemand.com")
let welcomeScreenStep = WelcomeScreenStep(transformer: discoveryConfigurationTransformer, providers: [discoveryServiceConfigProvider])

In a sample app of mine, once I press "Start" button, then the necessary information from the Discovery Service are fetched.


Thank you for your feedback about the documentation. The team will check on how to improve.

Please cross-check with the following documentation for administration activities for Discovery Service in Mobile Services (if not already done) : https://help.sap.com/doc/f53c64b93e5140918d676b927a3cd65b/Cloud/en-US/docs-en/guides/features/discov...

Best regards,
Marco

perage
Participant
0 Likes

Perfect! Thank you marco.eidinger ! Just a few lines of code and some screenshots away from publishing on the app store now :=)

Edit: I see that if I add both DiscoveryServiceConfigurationProvider and JSONConfigurationProvider, I get the option to enter email OR scan a QR code, hoewever, if I scan a QR that works, I still get an error saying "Enter a valid e-mail". Is it not possible to combine these options? We aim for one single app for multiple customers, and not everyone might be able to enable discovery..

Answers (0)