@wtfalch/auth 0.9.0 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/auth.js +6 -1
  2. package/package.json +1 -1
package/dist/auth.js CHANGED
@@ -135,7 +135,12 @@ export function createAuth(input) {
135
135
  };
136
136
  };
137
137
  const callback = async (request) => {
138
- const { location, cookies } = await complete(request.url, request.headers.get('cookie'));
138
+ // Behind a proxy the request can arrive as http:// or on an internal host,
139
+ // and `validCallback` would refuse it. The browser reached this app, so the
140
+ // path and query are what it asked for, on the app's own origin.
141
+ const { pathname, search } = new URL(request.url);
142
+ const callbackUrl = new URL(`${pathname}${search}`, options().appUrl).href;
143
+ const { location, cookies } = await complete(callbackUrl, request.headers.get('cookie'));
139
144
  return redirect(location, cookies);
140
145
  };
141
146
  const logout = async (request) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wtfalch/auth",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "Sign in against auth.wtfalch.dev: a server session for a Next.js app, and a browser client with silent single sign-on across subdomains.",
5
5
  "repository": {
6
6
  "type": "git",