Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AZURE API : AADSTS9002326: Cross-origin token redemption is permitted only for the 'Single-Page Application' client-type Error

I am trying to call a Azure Token retrieval API endpoint from a SAP Fiori application via a BTP destination. Getting below error while executing the token retrieval call.

enter image description here

Below is my destination:

enter image description here

Alternatively when I try to call the actual API endpoint with OAuth2UserTokenExchange I am getting HTTP 500 Internal Server error without any error description.

enter image description here

like image 414
Athul Ram Avatar asked Aug 31 '25 17:08

Athul Ram


2 Answers

I tried to reproduce the same in my environment in Postman and got the same error as below:

enter image description here

The error "AADSTS9002326: Cross-origin token redemption is permitted only for the 'Single-Page Application' client-type" usually occurs if you are using PKCE flow/SPA authentication and the Azure AD Application is configured as web like below:

enter image description here

To resolve the error, make sure to configure the Azure AD Application as SPA like below:

enter image description here

After the above changes, I am able to get the access token successfully like below:

Make sure to add origin in the Headers:

enter image description here

https://login.microsoftonline.com/TenantID/oauth2/v2.0/token

client_id:ClientID
scope:https://graph.microsoft.com/.default 
grant_type:authorization_code
code:code
code_verifier:S256
redirect_uri:https://jwt.ms

enter image description here

In your case, add the redirect URI https://port8080-workspace***** as SPA in Authentication blade of the Azure AD Application.

like image 52
Rukmini Avatar answered Sep 04 '25 17:09

Rukmini


i had a similar issue. But i had more than one platform registered in Azure App registration.

We had a mobile platform which had a Redirect URL: http://localhost And my SPA had: http://localhost:3000.

I think they were conflicting. I removed from the mobile and everything started working

like image 33
user2769011 Avatar answered Sep 04 '25 17:09

user2769011