npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

google-oauth-webview

v1.1.0

Published

A library to detect web views unsupported by Google OAuth

Downloads

130

Readme

Google OAuth Webview

Google OAuth fails in some webviews (in-app browsers) and displays a 403 disallowed_useragent error message. This library detects whether the user is in a webview that is not supported by Google OAuth.

Installation

npm install google-oauth-webview

Usage

import {
  isWebviewUnsupportedByGoogleOAuth,
  getWebviewOwner,
  WebviewOwner,
} from "google-oauth-webview";

// Checks if the user agent is a user agent of a web view that is not supported by Google OAuth.
const isSupported: boolean = isWebviewUnsupportedByGoogleOAuth(
  navigator.userAgent
);

// When possible, determines the owner of the webview based on the user agent.
// If the user agent does not match a webview or the webview owner cannot be determined, returns null.
const webviewOwner: WebviewOwner = getWebviewOwner(navigator.userAgent);

Sponsor

Linito logo

Browsers and applications tested

Legend

  • ✅ The application or browser has been tested and its user agent is present in the test.
  • ❌ The application or browser has NOT been tested.

Browsers tested

| Browser | Mac OS | Windows | iOS | Android | | ---------------- | ------ | ------- | --- | ------- | | Chrome | ✅ | ✅ | ✅ | ✅ | | Firefox | ✅ | ✅ | ✅ | ✅ | | Edge | ❌ | ✅ | ❌ | ❌ | | Safari | ✅ | ❌ | ✅ | ❌ | | Samsung Internet | ❌ | ❌ | ❌ | ✅ | | Opera | ❌ | ❌ | ❌ | ❌ |

Applications tested

| Application | iOS | Android | Uses a webview | Google OAuth works in webview | | ------------------ | --- | ------- | -------------- | ----------------------------- | | WhatsApp | ✅ | ❌ | no | - | | ProtonMail | ✅ | ❌ | no | - | | Telegram | ✅ | ❌ | yes | yes | | Gmail | ✅ | ❌ | yes | yes | | Slack | ✅ | ❌ | yes | yes | | Facebook Messenger | ✅ | ❌ | yes | no | | X / Twitter | ✅ | ❌ | yes | yes | | LinkedIn | ✅ | ❌ | yes | no | | reddit | ✅ | ❌ | yes | yes | | YouTube | ✅ | ❌ | yes | yes  | | Discord | ✅ | ❌ | yes | yes | | Facebook App | ✅ | ❌ | yes | no | | Instagram | ✅ | ❌ | yes | no |

Applications that still need to be tested

| Application | iOS | Android | | ----------- | --- | ------- | | TikTok | ❌ | ❌ | | Snapshat | ❌ | ❌ |

Contributing

  1. Connect your cell phone to your local network (e.g. wifi).
  2. Clone this repository and run npm run serve. This command will serve a web page on your local network, displaying the user agent. Copy the network URL displayed in the terminal.
  3. Paste the URL into your application (for example, if you're testing a messaging application, you can send the URL to yourself as a message).
  4. Click on the URL in your application and check whether the page is loaded in a web view or in the native browser. If the URL link doesn't work because it's an IP address, you can use the URL https://www.google.com/url?q=<your-local-URL> instead, which should do the trick.
  5. Copy and paste the user agent displayed in the src/user-agents.ts file.
  6. Test whether Google OAuth works in the webview. If not, update the library code and tests accordingly.
  7. Complete the README.

Rules

  • DO NOT copy and paste user agents found on forums, etc.
  • DO NOT copy and paste user agents returned by ChatGPT or other artificial intelligence platforms.

We want accurate data that has been tested on real devices with real applications.

Supported Node and TypeScript versions

|  Node min versions | TS min version | | ------------------ | -------------- | | 20, 22 | 5.6 |