Unable to send event data via Azure AD Authentication

We have a Docker-based Sentry on-premise setup.
The system URL is our Azure AD App proxy URL (https://sentry-organization.msappproxy.net).

We have followed the instructions based on ‘https://docs.sentry.io/platforms/react-native/’
The DSN is configured on our index.tsx file. which looks something like:

Sentry.init({

dsn: 'https://<app-secret>@sentry-organization.msappproxy.net/4',

environment: 'dev',

debug: true,

maxBreadcrumbs: 50,

})

We did try to run the app for testing and it seems like it somehow faces an issue with our token in Azure AD proxy. We found out that the Bearer token being used here is the ‘Auth-Token’ which we created from Sentry, rather than the Access Token which was provided by the Azure AD.

Below are the logs:

DEBUG 2020-03-18 19:52:31.856913 +02:00 request GET https://sentry-organization.msappproxy.net/api/0/organizations/organization/chunk-upload/
DEBUG 2020-03-18 19:52:31.858065 +02:00 using token authentication
DEBUG 2020-03-18 19:52:31.858527 +02:00 retry number 0, max retries: 0
DEBUG 2020-03-18 19:52:32.154274 +02:00 > GET /api/0/organization/o/chunk-upload/ HTTP/1.1
DEBUG 2020-03-18 19:52:32.154697 +02:00 > Host: sentry-organization.msappproxy.net
DEBUG 2020-03-18 19:52:32.154994 +02:00 > Accept: /
DEBUG 2020-03-18 19:52:32.155280 +02:00 > Connection: TE
DEBUG 2020-03-18 19:52:32.155552 +02:00 > TE: gzip
DEBUG 2020-03-18 19:52:32.155815 +02:00 > User-Agent: sentry-cli/1.51.1
DEBUG 2020-03-18 19:52:32.156914 +02:00 > Authorization: Bearer d983b7e0***
DEBUG 2020-03-18 19:52:46.659285 +02:00 < HTTP/1.1 302 Found
DEBUG 2020-03-18 19:52:46.660034 +02:00 < Content-Length: 0
DEBUG 2020-03-18 19:52:46.660903 +02:00 < Location: ***
DEBUG 2020-03-18 19:52:46.661310 +02:00 < Server: Microsoft-HTTPAPI/2.0
DEBUG 2020-03-18 19:52:46.661581 +02:00 < Set-Cookie: AzureAppProxyAnalyticCookie_***
DEBUG 2020-03-18 19:52:46.661928 +02:00 < Date: Wed, 18 Mar 2020 17:52:45 GMT
DEBUG 2020-03-18 19:52:46.662670 +02:00 response status: 302
DEBUG 2020-03-18 19:52:46.663166 +02:00 body:
error: not a JSON response

original comment by @ddzirt:

original comment by @jounii

Moved this under SDKs category as this is related to the SDK code, not Sentry itself. /cc @untitaker @bruno-garcia