cancel
Showing results for 
Search instead for 
Did you mean: 

SDK for assistant - Anonymous access not working (Api Key only)

0 Kudos

Hello Expert,

I try to create a new mobile application with SAP SDK for iOS Assistant (6.0.2 version). I want to have an anonymous access so I choose "Api Key Only" as authentication method.

After generating the project through the assistant, I run the application but I am not able to login:

Here the logs error:

Error requesting an OAuth2SAMLBearAssertion access token while processing Anonymous Authentication. Maybe the SAML metadata was not imported into the sub-account as a trusted identity provider, check the configuration. Category: IO Error, message: 401 Unauthorized: [no body]

Please advice.

Thanks in advance,
Dario

Accepted Solutions (1)

Accepted Solutions (1)

grabz
Employee
Employee
0 Kudos

Let me paste in the resolution of the issue if anyone meets it later:

"As the error says, we need to import SAML metadata into the sub-account for Basic auth and API key only SSO to work.

"Maybe the SAML metadata was not imported into the sub-account as a trusted identity provider, check the configuration."

Step to upload SAML metadata:

  1. Go to mobile service cockpit, Settings->Security and click on "Test" buttton. Setting up trust should failed with error. (refer CPMS screenshot)
  2. Now click on "Metadata download" button to download the SAML metadata. (refer CPMS screenshot)
  3. Open SAP BTP cockpit in new browser window and go to subaccount used for mobile service account. (refer BTPCockpit screenshot)
  4. Now go to Security->Trust Configuration and then click "New Trust Configuration" (refer BTPCockpit screenshot)
  5. Now upload the metadata downloaded previously and save it.
  6. Go back to mobile service cockpit and click on "Test" buttton. Trust test should be successful (refer CPMS screenshot)
  7. Now your app should work normally."

Other than that the server shows these errors:

Failed to request an OAuth2SAMLBearAssertion access token when process Anonymous Authentication. Maybe the SAML metadata has not been imported as a Trusted Identity provider into sub-account, please verify the configuration. Category: IO Error, message: 401 Unauthorized: [no body], details:

Get access token for anonymous user failed: {"name":"StatusCodeError","statusCode":500,"message":"500 - \"Generate Access Token with Saml Assertion failed: 401 Unauthorized: [no body]\"","error":"Generate Access Token with Saml Assertion failed: 401 Unauthorized: [no body]","options"...

KBA will be created soon. * UPDATE: 3052553 - API Key Only authentication fails with error: Error requesting an OAuth2SAMLBearAssertion access token while processing Anonymous Authentication.

Answers (2)

Answers (2)

0 Kudos

Hi Dario,

In that case, could you please raise a ticket on component MOB-SDK-IOS-FND?

Best Regards, Ashitha.

0 Kudos

done,

Regards

0 Kudos

Hi Dario,

Could you the app authentication configured in the OnboardingFlowProvider of the generated app? Is it APIKeyAuthenticationStep?

Best Regards,

Ashitha.

0 Kudos

Hello Ashitha,

yes, in the autogenerated project there is an APIKeyAuthenticationStep. Also the app in mobile services is well configured with "API Key Only" as authentication method.

public var onboardingSteps: [OnboardingStep] {<br>return [<br>self.configuredWelcomeScreenStep(),<br>CompositeStep(steps: SAPcpmsDefaultSteps.configuration),<br>APIKeyAuthenticationStep(config: self.getAPIKeyAuthenticationConfig()),<br>CompositeStep(steps: SAPcpmsDefaultSteps.settingsDownload),<br>CompositeStep(steps: SAPcpmsDefaultSteps.applyDuringOnboard),<br>self.configuredUserConsentStep(),<br>self.configuredUsageCollectionConsentStep(),<br>StoreManagerStep(),<br>ODataOnboardingStep(),<br>]<br>}