mirror of
https://github.com/better-auth/better-auth.git
synced 2026-06-05 13:56:30 -05:00
chore: remove unused file
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
import { APIError } from "better-call";
|
||||
import type { GenericEndpointContext } from "../types";
|
||||
|
||||
/**
|
||||
* Checks if the callbackURL is a valid URL and if it's in the trustedOrigins
|
||||
* to avoid open redirect attacks
|
||||
*/
|
||||
export const checkCallbackURL = (
|
||||
callbackURL: string,
|
||||
ctx: GenericEndpointContext,
|
||||
) => {
|
||||
const trustedOrigins = ctx.context.trustedOrigins;
|
||||
const callbackOrigin = callbackURL ? new URL(callbackURL).origin : null;
|
||||
if (callbackOrigin && !trustedOrigins.includes(callbackOrigin)) {
|
||||
throw new APIError("FORBIDDEN", {
|
||||
message: "Invalid callback URL",
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user