GoogleChrome / GoogleChrome/android-browser-helper

Trusted Web Activity - 302 redirects without user interactions are blocked

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

Description

**Describe the bug**
Using Trusted Web Activity for Auth use case doesn't seem to work since 302 redirections are blocked when the user doesn't interact with the screen. There are at least 2 cases where the user doesn't have to interact with the page
1. Already logged in session
2. Logging out of an existing session

We have tested this with multiple scenarios -
- This happens for both custom schemes and `https`
- Since trusted web activity shows proper full screen, we are sure the app link is verified properly
- The same code with a custom scheme works for Chrome Custom Tab but not for TWA
- The same code with TWA works in Firefox but not in Chrome/Brave

**To Reproduce**
I have added link to the app which has App Links configured (to avoid hassle for others checking it)
https://drive.google.com/file/d/1b7MzUn1wIQwtTf13pFgZlnREcyc_qgC7/view?usp=sharing

- Sign Up or Sign In using "LOG IN WITH BROWSER", this should work properly.
- Once logged in, logging in again or logging out doesn't work.

I have added video explaining this as well

**Expected behaviour**
TWA should be able to redirect users for the authentication use cases.

**Did this ever used to work**
This seems to work in Firefox.

**Screenshots**
Added screen recording demonstrating the following

✅ Log in without a previous session works properly
❌ Login when there is the previous section fails
❌ Logout fails
✅ After Logout, The user login page appears again successfully

Not Working in TWA
https://user-images.githubusercontent.com/15910425/174331969-9f30f7eb-3532-4460-84f0-e245c01f8fe7.mp4

Same Scenario Working in CCT
https://user-images.githubusercontent.com/15910425/174331943-738e12f5-338e-4d38-947e-ed07624509a0.mp4

**Code Snippets**
Code to launching TWA - [Link](https://github.com/auth0/Auth0.Android/blob/implement-trusted-web-activities/auth0/src/main/java/com/auth0/android/provider/CustomTabsController.java#L113)

**Smartphone (please complete the following information):**
- Device: Oneplus 7t pro
- OS: Android 11
- Browsers Installed : Chrome
- Browser Versions : 102.0.5005.125
- android-browser-helper library version 2.2.2

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.