简体   繁体   中英

Can I restrict access to my site using any browser other than an android apps developed by me?

I want to create an app which loads a website. This website should not be loaded by any other browser other than this app.

You can create a custom User-Agent for your app. And configure your website to only accept that User-Agent.

Though it's unlikely that someone else will use your selected User-Agent. But anyone can load your site if they get their hands on your User-Agent string.

This is how you set custom User-Agent on Webview

You can add in a hack by looking for specific headers, as suggested by @Shaiful. That will knock out anyone casually browsing the app. But there is no way to do this securely against anyone who's willing to spend some effort- its cryptographically impossible. The only way to authenticate is to share some secret. But an app would need to know that secret, and if the app knows it, it can be reverse engineered with ease. Which is why you can only authenticate users (because the secret is in their mind, not in the app), not applications.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM