PageSourceSearch

https://www.better.at/oauth-error-redirect.js

js better.at collected 2026-10-01 23:54:02 UTC 792 bytes, 23 lines download raw bytes

1/* global URL, URLSearchParams */
2(function () {
3  const searchParams = new URLSearchParams(window.location.search);
4  const hashParams = new URLSearchParams(window.location.hash.replace(/^#/, ''));
5  const error = searchParams.get('error') || hashParams.get('error');
6  const errorCode =
7    searchParams.get('error_code') || hashParams.get('error_code') || error;
8  const description =
9    searchParams.get('error_description') ||
10    hashParams.get('error_description') ||
11    '';
12
13  if (
14    errorCode !== 'bad_oauth_state' &&
15    description.toLowerCase().indexOf('oauth state') === -1
16  ) {
17    return;
18  }
19
20  const loginUrl = new URL('/login', window.location.origin);
21  loginUrl.searchParams.set('oauthError', 'bad_oauth_state');
22  window.location.replace(loginUrl.toString());
23})();

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.