GoogleChrome / GoogleChrome/android-browser-helper

Authorisation Issue in Header

Open
#364 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
832
Forks
370
Avg merge
1d 3h
Merged PRs (30d)
6

Description

Hi,

We've integrated browser Android SDK in our Production app and currently, we're on version v1.3.0 (androidx.browser:browser:1.3.0). We've encountered an issue with the SDK.
Whenever we are trying to access the URL by passing the Authorization token as a header, we are not able to open the URL.
The same thing is working whenever we are trying to open in the web chrome browser. So the expectation is if the user is already using the shared session(The user is already Registered on it). It should not ask the user to enter the credentials again. Please find the attached code for your reference
The user should be auto-login when we pass the authorization token in the header. The user should be redirected to the webpage without getting a login page.

We've inspected the Chrome custom tab with the help of chrome://inspect/#devices, and the passed header parameter is not visible in the request when we check in the inspect.

Below is the code we're using to open a web URL inside the chrome custom tab:
```
val customTabsIntent = CustomTabsIntent.Builder().build()
customTabsIntent?.intent?.setPackage("com.android.chrome")
val headers = Bundle()
headers.putString("Authorization", "Bearer $authToken") //authToken contain the Authorization token value.

customTabsIntent?.intent?.putExtra(Browser.EXTRA_HEADERS, headers)

context?.let { nonNullContext ->
customTabsIntent?.launchUrl(nonNullContext,Uri.parse(webViewUrl) //webViewUrl contain the string value of URL which we need to open in web page.
}
```
Please let me know if there is anything else I need to add to make it work.
Thanks

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.