Detect if user is on web or Android/iOS app

Hey guys! Due to some restrictions by Google, its social login is a bit of a pain for multi-OS apps: You need a different auth API key/token for the Google login feature depending on the operating system of the user.

This means I can allow my users to login with Google on my website, but if then the website is wrapped as an Android app (available to download on Google Play), I need a different login process (for a different auth API key/token).

The only way I’ve thought this would be possible is by splitting the workflows depending on the user OS:

  • If the user is on web, I go through the current login process, which works fine.
  • If the user is on an Android app, a different workflow.
  • If the user is on an iOS app, a different workflow.

How can I retrieve this information (web/Android/iOS) when the user opens the app? Thanks!


Sorry if this is very vague (I’m not at a computer right now), but the AirDev browser plugin might help.


Thanks a lot, @marcusandrews! I’ve installed the “Browser” plugin and now I can access the user agent and the platform info.

However, how can I know for sure if the device is a website, or an Android device using a wrapped app from that website? These are 3 different cases:

1. User from a website (Chrome on a MacBook):

  • User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.100 Safari/537.36
  • Platform: MacIntel

2. User from a website (Chrome on an Android smartphone):

  • User agent: Mozilla/5.0 (Linux; Android 9; H8416) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.111 Mobile Safari/537.36
  • Platform: Linux armv8l

3. User from an Android app:

  • User agent: Mozilla/5.0 (Linux; Android 9; H8416 Build/52.0.A.8.83; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.111 Mobile Safari/537.36
  • Platform: Linux armv8l

The only different pattern I see for the Android app is that it contains a “Build” words in the user agent. Would this be the case for anybody opening the app? If so, I think we have a chance to detect non-Android web vs Android web vs Android app! And the same for iOS.

+1 on this peeps anybody have any solutionis

This topic was automatically closed after 70 days. New replies are no longer allowed.