Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Clearing browsing data in chrome custom tab

Is it possible to clear browsing data, cookies, active logins, etc. behind the scenes(programatically) on chrome custom tabs?

My goal is to have the user be prompted to login every time they open the custom tab (instead of being logged in automatically)

like image 638
schwartzdotwork Avatar asked Jun 05 '17 18:06

schwartzdotwork


People also ask

What is Chrome Custom Tabs?

Custom Tabs is a browser feature, introduced by Chrome, that is now supported by most major browsers on Android. It gives apps more control over their web experience, and makes transitions between native and web content more seamless without having to resort to a WebView.

How do I close a custom tab in Chrome?

Let, you open chrome custom tab from "MainActivity" and there is a option menu item "Close" in chrome custom tab, and on "Close" menu item click you want to close chrome custom tab and to go back the "MainActivity", then you can do it by starting "MainActivity".


2 Answers

Shared cookie jar and permissions model so users don't have to log in to sites they are already connected to, or re-grant permissions they have already granted.

Chrome Custom Tabs is the Chrome browser (via the Chrome service and custom Intents) and thus the cache, cookies, etc.. are shared (actually the same).

The answer is no, you can not programmatically clear the data of Chrome.

Note: Right now there is no support of creating an Incognito-based Custom Tab

I would issue the user a transient/session cookie so it does not get persisted if you wish to forced a re-login on the start of every new session.

like image 81
SushiHangover Avatar answered Oct 02 '22 05:10

SushiHangover


"My goal is to have the user be prompted to login every time they open the custom tab (instead of being logged in automatically)"

As of now July 2020, on appauth's request builder you can use the method setPrompt(AuthorizationRequest.Prompt.LOGIN)

This will prompt the user to login every time.

If this method isn't provided and let's say there is some persistence needed (to log the user in automatically after they have logged in). If the server issues cookies to do this Currently it is a challenge to log the user out using an endpoint

like image 37
Chief Avatar answered Oct 02 '22 05:10

Chief