android-browser-helper icon indicating copy to clipboard operation
android-browser-helper copied to clipboard

help with adding custom headers

Open GoldaEV opened this issue 4 years ago • 10 comments

help with adding custom headers photo_2021-04-06_14-05-30 this is a screenshot from an example. My code doesn't work either. in Mainifest.xml <meta-data android:name="asset_statements" android:resource="@string/asset_statements" /> in string.xml <string name="asset_statements" translatable="false">[{ \"include\": \"https://qwerty.com/.well-known/assetlinks.json\" }] </string>

file from site: https://qwerty.com/.well-known/assetlinks.json [{ "relation": ["delegate_permission/common.use_as_origin"], "target" : { "namespace": "android_app", "package_name": "my.app.android", "sha256_cert_fingerprints": ["52:52:52:52:36:D9:4E:F3:DB:E5:3E:0E:7A:2D:3C:D8:08:8E:7A:FF:56:FC:30:E0:59:AC:05:43:CE:CE:CE:CE"] } }] the rest of the code is as in the example [(https://developer.chrome.com/docs/android/custom-tabs/headers/)]

GoldaEV avatar Apr 06 '21 11:04 GoldaEV

Trying to access https://qwerty.com/.well-known/assetlinks.json says the site is offline. The screenshot also seems to point to https://custom-tabs-custom-he.glitch.me/, which is not the site being validated. You should open a URL in https://qwerty.com since it's the origin being validated.

andreban avatar Apr 06 '21 13:04 andreban

qwerty.com was for example real - https://api.busy-fly.com/.well-known/assetlinks.json

GoldaEV avatar Apr 06 '21 13:04 GoldaEV

qwerty.com was for example real - https://api.busy-fly.com/.well-known/assetlinks.json

The asselinks file looks correct (assuming fingerprints match). So, the custom headers will only be sent when opening URLS under https://api.busy-fly.com.

andreban avatar Apr 06 '21 13:04 andreban

fingerprint taken with the utility изображение

but my full address looks like "https://api.busy-fly.com/end-user-api/v1/balance-package-purchase-payment-form?balance_package_id=${packageId}")

GoldaEV avatar Apr 06 '21 13:04 GoldaEV

also does not work with fingerprint keytool -list -v -keystore PATH_TO_KEYSTORE -alias VALUE_OF_ALIAS

GoldaEV avatar Apr 07 '21 14:04 GoldaEV

I tested this today and can see it working. I did find a couple of issues in the demo application and submitted #280 with fixes. Can you try with those fixes?

I just tested in an emulator with Chrome 89 and can see the demo working: Screenshot_1618231281

Maybe it's worth trying to remix the demo here https://glitch.com/edit/#!/custom-tabs-custom-he and changing public/.well-known/assetlinks.json to reflect your own app, then modify the URL on the Android demo.

andreban avatar Apr 12 '21 13:04 andreban

This headers

      headers.putString("bearer-token", "Some token");
      headers.putString("redirect-url", "Some redirect url");

Also not working for me, even with correctly configured .well-known/assetlinks.json Chrome 90.0.4430.91

DmitryDogar avatar May 11 '21 14:05 DmitryDogar

Hi guys, if you cannot see the extra headers from your app, the following info might be helpful.

  1. Find the /.well-known/assetlinks.json from https://glitch.com/edit/#!/custom-tabs-custom-he, you will not be able to see the .well-known folder on the left panel since it's a hidden folder. Click the "Remix to Edit" from the right top pop-up window, it will clone the project into your account. Then you can click the "Tools" on the left bottom, then "Terminal", and cd to ./public/.well-known and you'll see the assetlinks.json file.
  2. Replace the "sha256_cert_fingerprints" with yours.
  3. Make sure it contains "use_as_origin" relation "relation": ["delegate_permission/common.use_as_origin"]

Tested with Chrome 90.0.4430.210

lionandbull avatar May 25 '21 21:05 lionandbull

@andreban I setup my assetlinks file here https://namnh-0652.github.io/.well-known/assetlinks.json and try the demo app with my link "https://namnh-0652.github.io" but no headers are added.

CCT version 9x.

@DmitryDogar , @lionandbull any updated status from you guys?

namnh-0652 avatar Dec 13 '21 11:12 namnh-0652

@andreban I setup my assetlinks file here https://namnh-0652.github.io/.well-known/assetlinks.json and try the demo app with my link "https://namnh-0652.github.io" but no headers are added.

CCT version 9x.

@DmitryDogar , @lionandbull any updated status from you guys?

Same issue for me with the demo app (here is my assetlinks file)

rocklass avatar Dec 30 '21 16:12 rocklass