cancel
Showing results for 
Search instead for 
Did you mean: 

Asset Manager 2.0 authentication failed "The newly acquired or refreshed token got rejected"

former_member301443
Participant
0 Kudos

Dear expert

I have build an AssetManager 2.0 mobile application for xcode simulator and when i sign in the mobile app i am getting this error (see screenshot)

=> OAuth2Error.tokenRejected: The newly acquired or refreshed token got rejected.

User is not registered in SAPcpms.

With Postman: I am able to

- authenticate (thru SAPcpms)

- register user in SAPcpms

- access a SAPcpmsDestination https://mobilepreview-sfxxxxxxxxx.eu3.hana.ondemand.com/DEST_SAM20_PPROP/$metadata with an access token.

Thanks for your help. Regards.

Full trace

Accepted Solutions (1)

Accepted Solutions (1)

former_member301443
Participant
0 Kudos

It is working now.....

"SapCloudPlatformEndpoint" in BrandedSettings.json was incorrect

"https://mobile-xxx.eu3.hana.ondemand.com" instead of "https://mobilepreview-xxx.eu3.hana.ondemand.com",

Thanks for help. Regards.

Answers (3)

Answers (3)

former_member301443
Participant
0 Kudos

Dear Didier,

Please check the Url value defined in the Destination DEST_SAM20_PPROP ( SAP Cloud Platform Mobile Services) it should be as follows: http://<cloud connector virtual host>:<cloud connector virtual port> /sap/opu/odata/<mobile add-on component>/<mobile add-on service>

for example: http://fqdn:port/sap/opu/odata/MERP/SAP_ASSET_MANAGER_20

former_member301443
Participant
0 Kudos

Hi Bill,

I have checked this, but it seems correct. I have enclosed hereafter the lines containing "http" in the log.

You can see:

<-> url: https://accounts.sap.com/saml2/idp/sso/accounts.sap.com

<-> url: https://oauthasservices-sfxxxxxxx.eu3.hana.ondemand.com/oauth2/api/v1/authorize?response_type=***&cl...

<-> url: https://oauthasservices-sfxxxxxxx.eu3.hana.ondemand.com/?code=***

<-> url: https://oauthasservices-sfxxxxxxx.eu3.hana.ondemand.com/oauth2/api/v1/token

<-> url: https://mobile-sfxxxxxxx.eu3.hana.ondemand.com/mobileservices/application/com.ibm.meridia.swim.Asset...

2018-10-18 17:04:21.273161+0200 SWIMAssetManager20[17925:715360] [general] # SAP.Foundation.Authentication.OAuth2Observer - ERROR - (0x60c00026ebc0) - OAuth2Observer.swift.process(task:response:completionHandler:) - Rejected - This request has already authenticated and the new credentials got rejected!

From that, i think that the app is

- authenticating successfully to SCP

- getting an authorization code using the clientid

- getting an access token

but the access token seems rejected by app => ERROR - (0x60c00026ebc0) - OAuth2Observer.swift.process(task:response:completionHandler:) - Rejected - This request has already authenticated and the new credentials got rejected!


Thanks for help. Regards.

(/Users/xxxxxx/Desktop/SWIM/AssetManager/AssetManager2.0/MDKClient_SDK/SWIMAssetManager2.0/platforms/ios/SWIMAssetManager20/app/branding/BrandedSettings.json)

{

"ApplicationDisplayName": "SWIM Asset Manager 2.0",

"ConnectionSettings": {

"EnableOverrides": false,

"AppId": "com.xxx.meridia.swim.AssetManager",

"ClientId": "xxxxxx-1fa4-4d2e-9282-8d53e9a6dd63",

"SapCloudPlatformEndpoint": "https://mobile-xxxxxx.eu3.hana.ondemand.com",

"AuthorizationEndpointUrl": "https://oauthasservices-xxxxxx.eu3.hana.ondemand.com/oauth2/api/v1/authorize",

"RedirectUrl": "https://oauthasservices-xxxxxx.eu3.hana.ondemand.com",

"TokenUrl": "https://oauthasservices-xxxxxx.eu3.hana.ondemand.com/oauth2/api/v1/token",

"ServiceTimeZoneAbbreviation": "CET"

},

bill_froelich
Product and Topic Expert
Product and Topic Expert
0 Kudos

I would start by checking your connection settings. If your client id is incorrect or there are issues in the URLs that might explain the error.

In particular make sure the SapCloudPlatformEndpoint does not end with a slash character "/".

--Bill