FormidableLabs / react-native-app-auth

React native bridge for AppAuth - an SDK for communicating with OAuth2 providers
https://commerce.nearform.com/open-source/react-native-app-auth
MIT License
2.04k stars 441 forks source link

Add Custom User-Agent into Authorize Page #1021

Open veryprofessionaldodo opened 2 months ago

veryprofessionaldodo commented 2 months ago

I apologize before-hand if this is something that already exists, but I could not make this work, even when searching for this in the documentation.

We're trying to add a custom User-Agent header into the browser that opens the authorisation prompt. For this we tried to use both customHeaders and additionalHeaders for both iOS and Android, but we haven't been able to update the User Agent.

We've tried several combinations, like:

This resulted in a crash for iOS, with a 400 Bad Request being thrown. ``` additionalHeaders: { 'User Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Mobile/15E148 Safari/604.1 Test' } ``` The following two had no impact whatsoever. ``` additionalHeaders: { 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Mobile/15E148 Safari/604.1 Test' } ``` ``` additionalHeaders: { 'UserAgent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Mobile/15E148 Safari/604.1 Test' } ```

Is there any possibility for this feature to be implemented, or is it already present / can be done through a workaround?

Thank you for the support!