diff --git a/CHANGELOG.md b/CHANGELOG.md
index 4851cff..8920884 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [Unreleased]
+
+### Fixed
+
+- **Social login on Authorizer's login page now resumes the authorization request** ([authorizerdev/authorizer#855](https://github.com/authorizerdev/authorizer/issues/855)). When `/authorize` opens the login page (`/app` or `/app/signup`), `AuthorizerSocialLogin` sends that page's own URL as `redirect_uri`, with the `/authorize` parameters in the query string, instead of the client's callback. The login then comes back to `/app`, which replays the request to `/authorize`. A client whose callback is outside `--allowed-origins` can now use social login, and self-registered clients get the consent screen. Fragment parameters (`response_mode=fragment`) move into the query string.
+ - **Requires Authorizer 2.4.6 or later**, which accepts its own `/app` as a social-login `redirect_uri`. The hosted login page ships in the same image as the server, so it always meets this.
+ - **No change anywhere else:** it applies only when the page's origin equals `authorizerURL` and its URL carries both `client_id` and `response_type`. On your own site, `AuthorizerSocialLogin` sends the same `redirect_uri` as before.
+
## [2.0.0-rc.1] - 2025-12-30
### 🚀 Major Changes
diff --git a/eslint.config.js b/eslint.config.js
index b575bc9..a810c90 100644
--- a/eslint.config.js
+++ b/eslint.config.js
@@ -1,34 +1,57 @@
-module.exports = {
- root: true,
- env: {
- browser: true,
- es2021: true,
- node: true,
+// ESLint flat config (ESLint 9). Same intent as the previous .eslintrc-style
+// config: eslint:recommended + @typescript-eslint recommended + react
+// recommended + react-hooks recommended.
+const js = require('@eslint/js');
+const globals = require('globals');
+const tsPlugin = require('@typescript-eslint/eslint-plugin');
+const reactPlugin = require('eslint-plugin-react');
+const reactHooksPlugin = require('eslint-plugin-react-hooks');
+
+module.exports = [
+ {
+ ignores: [
+ 'dist/**',
+ 'storybook-static/**',
+ 'node_modules/**',
+ 'example/**',
+ '*.config.js',
+ '*.config.ts',
+ ],
},
- extends: [
- 'eslint:recommended',
- 'plugin:@typescript-eslint/recommended',
- 'plugin:react/recommended',
- 'plugin:react-hooks/recommended',
- ],
- parser: '@typescript-eslint/parser',
- parserOptions: {
- ecmaVersion: 'latest',
- sourceType: 'module',
- ecmaFeatures: {
- jsx: true,
+ js.configs.recommended,
+ ...tsPlugin.configs['flat/recommended'],
+ reactPlugin.configs.flat.recommended,
+ reactHooksPlugin.configs['recommended-latest'],
+ {
+ files: ['**/*.{ts,tsx}'],
+ languageOptions: {
+ ecmaVersion: 'latest',
+ sourceType: 'module',
+ parserOptions: {
+ ecmaFeatures: {
+ jsx: true,
+ },
+ },
+ globals: {
+ ...globals.browser,
+ ...globals.es2021,
+ ...globals.node,
+ },
},
- },
- plugins: ['react', 'react-hooks', '@typescript-eslint'],
- settings: {
- react: {
- version: 'detect',
+ settings: {
+ react: {
+ version: 'detect',
+ },
+ },
+ rules: {
+ 'react/react-in-jsx-scope': 'off',
+ 'react/prop-types': 'off',
+ // warn, not error: ~40 pre-existing `any`s; typing them properly is a separate change.
+ '@typescript-eslint/no-explicit-any': 'warn',
+ '@typescript-eslint/no-unused-vars': [
+ 'warn',
+ { argsIgnorePattern: '^_' },
+ ],
},
},
- rules: {
- 'react/react-in-jsx-scope': 'off',
- 'react/prop-types': 'off',
- '@typescript-eslint/no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
- },
- ignorePatterns: ['dist/**', 'node_modules/**', '*.config.js', '*.config.ts'],
-};
+];
diff --git a/package-lock.json b/package-lock.json
index db37e32..93074be 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -13,6 +13,7 @@
"validator": "^13.11.0"
},
"devDependencies": {
+ "@eslint/js": "^9.39.5",
"@size-limit/preset-small-lib": "^11.1.0",
"@storybook/addon-essentials": "8.4.0",
"@storybook/addon-interactions": "8.4.0",
@@ -34,6 +35,7 @@
"eslint": "^9.17.0",
"eslint-plugin-react": "^7.37.0",
"eslint-plugin-react-hooks": "^5.1.0",
+ "globals": "^17.14.0",
"husky": "^9.1.7",
"jsdom": "^26.1.0",
"postcss": "^8.4.49",
@@ -342,6 +344,16 @@
"node": ">=6.9.0"
}
},
+ "node_modules/@babel/traverse/node_modules/globals": {
+ "version": "11.12.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz",
+ "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=4"
+ }
+ },
"node_modules/@babel/types": {
"version": "7.29.0",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.0.tgz",
@@ -1088,9 +1100,9 @@
"license": "MIT"
},
"node_modules/@eslint/js": {
- "version": "9.39.2",
- "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.2.tgz",
- "integrity": "sha512-q1mjIoW1VX4IvSocvM/vbTiveKC4k9eLrajNEuSsmjymSDEbpGddtpfOoN7YGAqBK3NG+uqo8ia4PDTt8buCYA==",
+ "version": "9.39.5",
+ "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.5.tgz",
+ "integrity": "sha512-QywQuszQh77pIXCsq998c8hbhSTI/azTty1Z6N53dmAudKHhy573j3yvRLsX2BSp8YpLtoCEG8E9DJe+8zUh4A==",
"dev": true,
"license": "MIT",
"engines": {
@@ -5591,6 +5603,19 @@
"node": ">=4.0"
}
},
+ "node_modules/eslint/node_modules/@eslint/js": {
+ "version": "9.39.2",
+ "resolved": "https://registry.npmjs.org/@eslint/js/-/js-9.39.2.tgz",
+ "integrity": "sha512-q1mjIoW1VX4IvSocvM/vbTiveKC4k9eLrajNEuSsmjymSDEbpGddtpfOoN7YGAqBK3NG+uqo8ia4PDTt8buCYA==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": "^18.18.0 || ^20.9.0 || >=21.1.0"
+ },
+ "funding": {
+ "url": "https://eslint.org/donate"
+ }
+ },
"node_modules/eslint/node_modules/ajv": {
"version": "6.14.0",
"resolved": "https://registry.npmjs.org/ajv/-/ajv-6.14.0.tgz",
@@ -6577,12 +6602,16 @@
"license": "BSD-2-Clause"
},
"node_modules/globals": {
- "version": "11.12.0",
- "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz",
- "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==",
+ "version": "17.14.0",
+ "resolved": "https://registry.npmjs.org/globals/-/globals-17.14.0.tgz",
+ "integrity": "sha512-UtdkTVyAJePQv0J2M9Xe4L0ruNSDV314XiIJsADI2Zf40bcdAonE/D/OhAU8AT99oij9mhLByb+NvA3QWZYgCg==",
"dev": true,
+ "license": "MIT",
"engines": {
- "node": ">=4"
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/globalthis": {
@@ -10588,24 +10617,6 @@
"node": ">= 12"
}
},
- "node_modules/tsup/node_modules/yaml": {
- "version": "2.9.0",
- "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.9.0.tgz",
- "integrity": "sha512-2AvhNX3mb8zd6Zy7INTtSpl1F15HW6Wnqj0srWlkKLcpYl/gMIMJiyuGq2KeI2YFxUPjdlB+3Lc10seMLtL4cA==",
- "dev": true,
- "license": "ISC",
- "optional": true,
- "peer": true,
- "bin": {
- "yaml": "bin.mjs"
- },
- "engines": {
- "node": ">= 14.6"
- },
- "funding": {
- "url": "https://github.com/sponsors/eemeli"
- }
- },
"node_modules/tween-functions": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/tween-functions/-/tween-functions-1.2.0.tgz",
@@ -11470,24 +11481,6 @@
}
}
},
- "node_modules/vite-node/node_modules/yaml": {
- "version": "2.9.0",
- "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.9.0.tgz",
- "integrity": "sha512-2AvhNX3mb8zd6Zy7INTtSpl1F15HW6Wnqj0srWlkKLcpYl/gMIMJiyuGq2KeI2YFxUPjdlB+3Lc10seMLtL4cA==",
- "dev": true,
- "license": "ISC",
- "optional": true,
- "peer": true,
- "bin": {
- "yaml": "bin.mjs"
- },
- "engines": {
- "node": ">= 14.6"
- },
- "funding": {
- "url": "https://github.com/sponsors/eemeli"
- }
- },
"node_modules/vitest": {
"version": "3.2.7",
"resolved": "https://registry.npmjs.org/vitest/-/vitest-3.2.7.tgz",
@@ -12256,24 +12249,6 @@
}
}
},
- "node_modules/vitest/node_modules/yaml": {
- "version": "2.9.0",
- "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.9.0.tgz",
- "integrity": "sha512-2AvhNX3mb8zd6Zy7INTtSpl1F15HW6Wnqj0srWlkKLcpYl/gMIMJiyuGq2KeI2YFxUPjdlB+3Lc10seMLtL4cA==",
- "dev": true,
- "license": "ISC",
- "optional": true,
- "peer": true,
- "bin": {
- "yaml": "bin.mjs"
- },
- "engines": {
- "node": ">= 14.6"
- },
- "funding": {
- "url": "https://github.com/sponsors/eemeli"
- }
- },
"node_modules/w3c-xmlserializer": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/w3c-xmlserializer/-/w3c-xmlserializer-5.0.0.tgz",
diff --git a/package.json b/package.json
index e9326b5..7c0d0c3 100644
--- a/package.json
+++ b/package.json
@@ -24,7 +24,7 @@
"start": "tsup --watch",
"build": "tsup",
"test": "vitest run",
- "lint": "eslint src --ext .ts,.tsx --fix",
+ "lint": "eslint src --fix",
"type-check": "tsc --noEmit",
"prepare": "tsup",
"size": "size-limit",
@@ -59,6 +59,7 @@
}
],
"devDependencies": {
+ "@eslint/js": "^9.39.5",
"@size-limit/preset-small-lib": "^11.1.0",
"@storybook/addon-essentials": "8.4.0",
"@storybook/addon-interactions": "8.4.0",
@@ -80,6 +81,7 @@
"eslint": "^9.17.0",
"eslint-plugin-react": "^7.37.0",
"eslint-plugin-react-hooks": "^5.1.0",
+ "globals": "^17.14.0",
"husky": "^9.1.7",
"jsdom": "^26.1.0",
"postcss": "^8.4.49",
diff --git a/src/__tests__/AuthorizerSocialLogin.test.tsx b/src/__tests__/AuthorizerSocialLogin.test.tsx
new file mode 100644
index 0000000..7772159
--- /dev/null
+++ b/src/__tests__/AuthorizerSocialLogin.test.tsx
@@ -0,0 +1,117 @@
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { fireEvent, render, screen } from '@testing-library/react';
+
+import { AuthorizerSocialLogin } from '../components/AuthorizerSocialLogin';
+
+const AUTHORIZER = 'https://auth.example.com';
+const CLIENT_CALLBACK = 'https://app.example.org/cb';
+
+let authorizerURL = AUTHORIZER;
+vi.mock('../contexts/AuthorizerContext', () => ({
+ useAuthorizer: () => ({
+ config: {
+ authorizerURL,
+ redirectURL: `${AUTHORIZER}/app`,
+ is_github_login_enabled: true,
+ is_mfa_enforced: true, // keeps the passkey separator logic out of the way
+ },
+ }),
+}));
+
+// jsdom cannot navigate, so replace window.location with a plain object that
+// records the href each button assigns.
+const realLocation = window.location;
+const setLocation = (url: string) => {
+ const u = new URL(url);
+ Object.defineProperty(window, 'location', {
+ configurable: true,
+ writable: true,
+ value: {
+ origin: u.origin,
+ pathname: u.pathname,
+ search: u.search,
+ hash: u.hash,
+ href: url,
+ },
+ });
+};
+
+// clickGithub returns the /oauth_login query the GitHub button navigates to.
+const clickGithub = () => {
+ fireEvent.click(screen.getByText('Continue with Github'));
+ const target = new URL(window.location.href);
+ expect(target.origin + target.pathname).toBe(
+ `${AUTHORIZER}/oauth_login/github`
+ );
+ return target.searchParams;
+};
+
+// urlProps as web/app's Root builds them from the /app URL.
+const urlPropsFor = (redirect: string) => ({
+ state: 's1',
+ scope: ['openid', 'profile', 'email'],
+ redirect_uri: redirect,
+ redirectURL: redirect,
+});
+
+const AUTHORIZE_QUERY =
+ 'state=s1&scope=openid+profile+email&redirect_uri=https%3A%2F%2Fapp.example.org%2Fcb' +
+ '&response_mode=query&response_type=code&client_id=c1&nonce=n1';
+
+describe('AuthorizerSocialLogin redirect_uri', () => {
+ beforeEach(() => {
+ authorizerURL = AUTHORIZER;
+ });
+ afterEach(() => {
+ Object.defineProperty(window, 'location', {
+ configurable: true,
+ value: realLocation,
+ });
+ });
+
+ it('inside an /authorize request on /app, returns to /app, not to the client', () => {
+ // The URL a browser is on: Authorizer 301s /app to /app/.
+ const appURL = `${AUTHORIZER}/app/?${AUTHORIZE_QUERY}`;
+ setLocation(appURL);
+ render(