Redirect and callback protection
Exact callbacks and private browser-bound backend sessions protect parameter-free returns.
On this page
Register an exact callback
AnyOAuth redirects only to URLs on your project’s exact allowlist. HTTPS is required except for HTTP loopback during development. Credentials, queries, fragments, wildcards and ambiguous URL syntax are not callback registration features.
The API rechecks the allowlist before success and denial/error redirects. Removing a callback while sign-in is in progress prevents that transaction from returning to it.
Bind clean callbacks to the initiating browser
The managed router performs these steps automatically. Browser helpers only navigate to and read from that backend; they do not store private login keys. Frontend framework examples use the same callback protections.
For a manual integration, call SDK startLogin({provider, redirectUri}) on your backend.
It generates a private loginAttempt and registers its random key with the
session API. Save loginAttempt in a ten-minute server
session selected by a Secure HttpOnly SameSite=Lax browser cookie. The launch URL uses a
separate opaque ID; it does not disclose the private result key.
AnyOAuth returns to your registered callback without query parameters or a fragment.
Require the saved browser cookie and call completeLogin({loginAttempt}) with its saved
attempt. The SDK uses the result API server-to-server. Reject query-bearing callbacks.
Terminal results are retrieved once, with client credentials and exact callback binding.
Only succeeded results with a valid profile can establish an application session.
Use one active pending login per browser. A callback must never select a transaction by guessing a key or searching all users’ pending records. Pending results are not proof of authentication. AnyOAuth still verifies provider state, nonce, PKCE and its own initiating browser cookie before completing the session.
Legacy flow: bind state to the initiating session
Use createLoginAttempt() to generate random state and a PKCE verifier/challenge.
This is temporary security data for one login attempt; it makes no API call and does
not authenticate anyone. Save it with the exact registered callback in
the initiating browser’s server session or appropriate protected app storage.
Then pass its state and challenge to createLoginURL({provider, redirectUri, state, codeChallenge}).
import { AnyOAuth } from "@anyoauth/node";
const client = new AnyOAuth({
clientId: process.env.ANYOAUTH_CLIENT_ID ?? "YOUR_CLIENT_ID",
clientSecret: process.env.ANYOAUTH_CLIENT_SECRET ?? "YOUR_CLIENT_SECRET",
baseUrl: process.env.ANYOAUTH_API_ORIGIN ?? "https://api.anyoauth.com",
});
const transaction = await client.createLoginAttempt();
// Persist this transaction in the initiating session before navigation.
const authorizationUrl = client.createLoginURL({
provider: "google",
redirectUri: process.env.ANYOAUTH_REDIRECT_URI ?? "https://your-app.example/auth/callback",
state: transaction.state,
codeChallenge: transaction.codeChallenge
});
npm install @anyoauth/nodeConfidential backend SDKCurrent source example · published 0.1.0 predates these helpers
// Supply these public settings from your app configuration.
const settings = globalThis.ANYOAUTH_SETTINGS ?? {};
import { AnyOAuth } from "@anyoauth/client";
const client = new AnyOAuth({
clientId: settings.ANYOAUTH_CLIENT_ID ?? "YOUR_CLIENT_ID",
baseUrl: settings.ANYOAUTH_API_ORIGIN ?? "https://api.anyoauth.com",
});
const transaction = await client.createLoginAttempt();
// Persist this transaction in the initiating session before navigation.
const authorizationUrl = client.createLoginURL({
provider: "google",
redirectUri: settings.ANYOAUTH_REDIRECT_URI ?? "https://your-app.example/auth/callback",
state: transaction.state,
codeChallenge: transaction.codeChallenge
});
npm install @anyoauth/clientClient helpers · backend exchange requiredCurrent source example · published 0.1.0 predates these helpers
// Supply these public settings from your app configuration.
const settings = globalThis.ANYOAUTH_SETTINGS ?? {};
import { AnyOAuth } from "@anyoauth/expo/native";
import * as Crypto from 'expo-crypto';
const client = new AnyOAuth({
crypto: Crypto,
clientId: settings.ANYOAUTH_CLIENT_ID ?? "YOUR_CLIENT_ID",
baseUrl: settings.ANYOAUTH_API_ORIGIN ?? "https://api.anyoauth.com",
});
const transaction = await client.createLoginAttempt();
// Persist this transaction in the initiating session before navigation.
const authorizationUrl = client.createLoginURL({
provider: "google",
redirectUri: settings.ANYOAUTH_REDIRECT_URI ?? "https://your-app.example/auth/callback",
state: transaction.state,
codeChallenge: transaction.codeChallenge
});
npm install @anyoauth/expoClient helpers · backend exchange requiredCurrent source example · published 0.1.0 predates these helpers
import os
from anyoauth import Client
client = Client(os.getenv("ANYOAUTH_CLIENT_ID", "YOUR_CLIENT_ID"), os.getenv("ANYOAUTH_CLIENT_SECRET", "YOUR_CLIENT_SECRET"), os.getenv("ANYOAUTH_API_ORIGIN", "https://api.anyoauth.com"))
transaction = client.create_login_attempt()
# Persist the transaction in the initiating session.
authorizationUrl = client.create_login_url({"provider": "google", "redirectUri": os.getenv("ANYOAUTH_REDIRECT_URI", "https://your-app.example/auth/callback"), "state": transaction["state"], "codeChallenge": transaction["codeChallenge"]})
python -m pip install anyoauth-sdkConfidential backend SDKCurrent source example · published 0.1.0 predates these helpers
package main
import (
"os"
anyoauth "github.com/AnyOAuth/anyoauth-go"
)
func env(key, fallback string) string { if v := os.Getenv(key); v != "" { return v }; return fallback }
func main() {
client, err := anyoauth.NewClient(env("ANYOAUTH_API_ORIGIN", "https://api.anyoauth.com"), env("ANYOAUTH_CLIENT_ID", "YOUR_CLIENT_ID"), env("ANYOAUTH_CLIENT_SECRET", "YOUR_CLIENT_SECRET"))
if err != nil { panic(err) }
transaction, err := client.CreateLoginAttempt(nil)
if err != nil { panic(err) }
// Persist the transaction in the initiating session.
authorizationUrl, err := client.CreateLoginURL(map[string]any{"provider": "google", "redirectUri": env("ANYOAUTH_REDIRECT_URI", "https://your-app.example/auth/callback"), "state": transaction["state"].(string), "codeChallenge": transaction["codeChallenge"].(string)})
if err != nil { panic(err) }
_ = authorizationUrl
}
go get github.com/AnyOAuth/anyoauth-goConfidential backend SDKCurrent source example
<?php
require 'vendor/autoload.php';
$client = new \AnyOAuth\Client((getenv("ANYOAUTH_CLIENT_ID") ?: "YOUR_CLIENT_ID"), (getenv("ANYOAUTH_CLIENT_SECRET") ?: "YOUR_CLIENT_SECRET"), (getenv("ANYOAUTH_API_ORIGIN") ?: "https://api.anyoauth.com"));
$transaction = $client->createLoginAttempt();
// Persist the transaction in the initiating session.
$authorizationUrl = $client->createLoginURL(["provider" => "google", "redirectUri" => (getenv("ANYOAUTH_REDIRECT_URI") ?: "https://your-app.example/auth/callback"), "state" => $transaction->state, "codeChallenge" => $transaction->codeChallenge]);
composer require anyoauth/anyoauthConfidential backend SDKCurrent source example · published 0.1.0 predates these helpers
import com.anyoauth.AnyOAuth;
import com.google.gson.*;
public class Example {
static String env(String key, String fallback) { String value = System.getenv(key); return value == null ? fallback : value; }
public static void main(String[] args) {
AnyOAuth client = new AnyOAuth(env("ANYOAUTH_API_ORIGIN", "https://api.anyoauth.com"), env("ANYOAUTH_CLIENT_ID", "YOUR_CLIENT_ID"), env("ANYOAUTH_CLIENT_SECRET", "YOUR_CLIENT_SECRET"));
JsonObject transaction = client.createLoginAttempt(new JsonObject());
// Persist the transaction in the initiating session.
JsonObject params = new JsonObject();
params.addProperty("provider", "google");
params.addProperty("redirectUri", env("ANYOAUTH_REDIRECT_URI", "https://your-app.example/auth/callback"));
params.addProperty("state", transaction.get("state").getAsString());
params.addProperty("codeChallenge", transaction.get("codeChallenge").getAsString());
var authorizationUrl = client.createLoginURL(params);
}
}
Gradle: implementation("com.anyoauth:anyoauth:0.1.0")Confidential backend SDKCurrent source example · published 0.1.0 predates these helpers
require "anyoauth"
client = AnyOAuth::Client.new(ENV.fetch("ANYOAUTH_CLIENT_ID", "YOUR_CLIENT_ID"), ENV.fetch("ANYOAUTH_CLIENT_SECRET", "YOUR_CLIENT_SECRET"), ENV.fetch("ANYOAUTH_API_ORIGIN", "https://api.anyoauth.com"))
transaction = client.create_login_attempt
# Persist the transaction in the initiating session.
authorizationUrl = client.create_login_url({"provider" => "google", "redirectUri" => ENV.fetch("ANYOAUTH_REDIRECT_URI", "https://your-app.example/auth/callback"), "state" => transaction["state"], "codeChallenge" => transaction["codeChallenge"]})
gem install anyoauth-sdkConfidential backend SDKCurrent source example · published 0.1.0 predates these helpers
using System;
using System.Text.Json.Nodes;
using AnyOAuth;
using var client = new Client(Environment.GetEnvironmentVariable("ANYOAUTH_API_ORIGIN") ?? "https://api.anyoauth.com", Environment.GetEnvironmentVariable("ANYOAUTH_CLIENT_ID") ?? "YOUR_CLIENT_ID", Environment.GetEnvironmentVariable("ANYOAUTH_CLIENT_SECRET") ?? "YOUR_CLIENT_SECRET");
var transaction = client.CreateLoginAttempt(new JsonObject());
// Persist the transaction in the initiating session.
var authorizationUrl = client.CreateLoginURL(new JsonObject { ["provider"] = "google", ["redirectUri"] = Environment.GetEnvironmentVariable("ANYOAUTH_REDIRECT_URI") ?? "https://your-app.example/auth/callback", ["state"] = transaction["state"]!.GetValue<string>(), ["codeChallenge"] = transaction["codeChallenge"]!.GetValue<string>() });
dotnet add reference /path/to/anyoauth/sdks/dotnet/AnyOAuth.SDK.csprojConfidential backend SDKCurrent source example
use anyoauth_sdk::*;
use serde_json::json;
fn env(key: &str, fallback: &str) -> String { std::env::var(key).unwrap_or_else(|_| fallback.to_owned()) }
fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = Client::new(&env("ANYOAUTH_API_ORIGIN", "https://api.anyoauth.com"), &env("ANYOAUTH_CLIENT_ID", "YOUR_CLIENT_ID"), &env("ANYOAUTH_CLIENT_SECRET", "YOUR_CLIENT_SECRET"))?;
let transaction = client.create_login_attempt(&json!({}))?;
// Persist the transaction in the initiating session.
let authorizationUrl = client.create_login_url(&json!({"provider": "google", "redirectUri": env("ANYOAUTH_REDIRECT_URI", "https://your-app.example/auth/callback"), "state": transaction["state"].as_str().unwrap(), "codeChallenge": transaction["codeChallenge"].as_str().unwrap()}))?;
let _ = &authorizationUrl;
Ok(())
}
cargo add anyoauth-sdkConfidential backend SDKCurrent source example · published 0.1.0 predates these helpers
client = AnyOAuth.new((System.get_env("ANYOAUTH_CLIENT_ID") || "YOUR_CLIENT_ID"), (System.get_env("ANYOAUTH_CLIENT_SECRET") || "YOUR_CLIENT_SECRET"), (System.get_env("ANYOAUTH_API_ORIGIN") || "https://api.anyoauth.com"))
transaction = AnyOAuth.create_login_attempt(client)
# Persist the transaction in the initiating session.
authorizationUrl = AnyOAuth.create_login_url(client, %{"provider" => "google", "redirectUri" => (System.get_env("ANYOAUTH_REDIRECT_URI") || "https://your-app.example/auth/callback"), "state" => transaction["state"], "codeChallenge" => transaction["codeChallenge"]})
mix.exs: {:anyoauth_sdk, "~> 0.1"}Confidential backend SDKCurrent source example · published 0.1.0 predates these helpers
import Foundation
import AnyOAuth
func env(_ key: String, _ fallback: String) -> String { ProcessInfo.processInfo.environment[key] ?? fallback }
let client = try AnyOAuth(clientId: env("ANYOAUTH_CLIENT_ID", "YOUR_CLIENT_ID"), baseUrl: env("ANYOAUTH_API_ORIGIN", "https://api.anyoauth.com"))
let transaction = try client.createLoginAttempt()
// Persist the transaction in the initiating session.
let authorizationUrl = try client.createLoginURL(provider: "google", redirectUri: env("ANYOAUTH_REDIRECT_URI", "https://your-app.example/auth/callback"), state: transaction.state, codeChallenge: transaction.codeChallenge)
.package(url: "https://github.com/AnyOAuth/anyoauth-swift.git", exact: "0.1.0")Client helpers · backend exchange requiredCurrent source example
import com.anyoauth.*
fun env(key: String, fallback: String): String = System.getenv(key) ?: fallback
fun main() {
val client = AnyOAuth(env("ANYOAUTH_CLIENT_ID", "YOUR_CLIENT_ID"), env("ANYOAUTH_API_ORIGIN", "https://api.anyoauth.com"))
val transaction = client.createLoginAttempt()
// Persist the transaction in the initiating session.
val authorizationUrl = client.createLoginURL(provider = "google", redirectUri = env("ANYOAUTH_REDIRECT_URI", "https://your-app.example/auth/callback"), state = transaction.state, codeChallenge = transaction.codeChallenge)
}
implementation("com.anyoauth:anyoauth-client:0.1.0")Client helpers · backend exchange requiredCurrent source example · published 0.1.0 predates these helpers
import 'dart:io';
import 'package:anyoauth_client/anyoauth_client.dart';
String env(String key, String fallback) => Platform.environment[key] ?? fallback;
void main() {
final client = AnyOAuth(clientId: env("ANYOAUTH_CLIENT_ID", "YOUR_CLIENT_ID"), baseUrl: env("ANYOAUTH_API_ORIGIN", "https://api.anyoauth.com"));
final transaction = client.createLoginAttempt();
// Persist the transaction in the initiating session.
final authorizationUrl = client.createLoginURL(provider: "google", redirectUri: env("ANYOAUTH_REDIRECT_URI", "https://your-app.example/auth/callback"), state: transaction.state, codeChallenge: transaction.codeChallenge);
}
flutter pub add anyoauth_client --path /path/to/anyoauth/sdks/clients/flutterClient helpers · backend exchange requiredCurrent source example
Call validateLoginCallback with the returning URL and saved state, callback and expiry
before using a code. Consume the saved transaction
atomically, even on denial; the helper does not provide persistent session storage.
Legacy flow: keep the PKCE verifier
The S256 challenge is sent during authorization; the original verifier is sent only to the code-exchange endpoint from the confidential backend. A mismatched verifier cannot redeem the grant. Do not place the verifier or secret in a redirect URL.
import { AnyOAuth } from "@anyoauth/node";
const client = new AnyOAuth({
clientId: process.env.ANYOAUTH_CLIENT_ID ?? "YOUR_CLIENT_ID",
clientSecret: process.env.ANYOAUTH_CLIENT_SECRET ?? "YOUR_CLIENT_SECRET",
baseUrl: process.env.ANYOAUTH_API_ORIGIN ?? "https://api.anyoauth.com",
});
const challenge = await client.pkceChallenge({
codeVerifier: process.env.ANYOAUTH_CODE_VERIFIER ?? "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"
});
npm install @anyoauth/nodeConfidential backend SDKPublished 0.1.0 API
// Supply these public settings from your app configuration.
const settings = globalThis.ANYOAUTH_SETTINGS ?? {};
import { AnyOAuth } from "@anyoauth/client";
const client = new AnyOAuth({
clientId: settings.ANYOAUTH_CLIENT_ID ?? "YOUR_CLIENT_ID",
baseUrl: settings.ANYOAUTH_API_ORIGIN ?? "https://api.anyoauth.com",
});
const challenge = await client.pkceChallenge({
codeVerifier: settings.ANYOAUTH_CODE_VERIFIER ?? "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"
});
npm install @anyoauth/clientClient helpers · backend exchange requiredPublished 0.1.0 API
// Supply these public settings from your app configuration.
const settings = globalThis.ANYOAUTH_SETTINGS ?? {};
import { AnyOAuth } from "@anyoauth/expo/native";
import * as Crypto from 'expo-crypto';
const client = new AnyOAuth({
crypto: Crypto,
clientId: settings.ANYOAUTH_CLIENT_ID ?? "YOUR_CLIENT_ID",
baseUrl: settings.ANYOAUTH_API_ORIGIN ?? "https://api.anyoauth.com",
});
const challenge = await client.pkceChallenge({
codeVerifier: settings.ANYOAUTH_CODE_VERIFIER ?? "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"
});
npm install @anyoauth/expoClient helpers · backend exchange requiredPublished 0.1.0 API
import os
from anyoauth import Client
client = Client(os.getenv("ANYOAUTH_CLIENT_ID", "YOUR_CLIENT_ID"), os.getenv("ANYOAUTH_CLIENT_SECRET", "YOUR_CLIENT_SECRET"), os.getenv("ANYOAUTH_API_ORIGIN", "https://api.anyoauth.com"))
challenge = client.pkce_challenge({"codeVerifier": os.getenv("ANYOAUTH_CODE_VERIFIER", "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk")})
python -m pip install anyoauth-sdkConfidential backend SDKPublished 0.1.0 API
package main
import (
"os"
anyoauth "github.com/AnyOAuth/anyoauth-go"
)
func env(key, fallback string) string { if v := os.Getenv(key); v != "" { return v }; return fallback }
func main() {
challenge, err := anyoauth.PKCEChallenge(env("ANYOAUTH_CODE_VERIFIER", "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"))
if err != nil { panic(err) }
_ = challenge
}
go get github.com/AnyOAuth/anyoauth-goConfidential backend SDKCurrent source example
<?php
require 'vendor/autoload.php';
$client = new \AnyOAuth\Client((getenv("ANYOAUTH_CLIENT_ID") ?: "YOUR_CLIENT_ID"), (getenv("ANYOAUTH_CLIENT_SECRET") ?: "YOUR_CLIENT_SECRET"), (getenv("ANYOAUTH_API_ORIGIN") ?: "https://api.anyoauth.com"));
$challenge = $client->pkceChallenge(["codeVerifier" => (getenv("ANYOAUTH_CODE_VERIFIER") ?: "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk")]);
composer require anyoauth/anyoauthConfidential backend SDKPublished 0.1.0 API
import com.anyoauth.AnyOAuth;
import com.google.gson.*;
public class Example {
static String env(String key, String fallback) { String value = System.getenv(key); return value == null ? fallback : value; }
public static void main(String[] args) {
var challenge = AnyOAuth.pkceChallenge(env("ANYOAUTH_CODE_VERIFIER", "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"));
}
}
Gradle: implementation("com.anyoauth:anyoauth:0.1.0")Confidential backend SDKPublished 0.1.0 API
require "anyoauth"
client = AnyOAuth::Client.new(ENV.fetch("ANYOAUTH_CLIENT_ID", "YOUR_CLIENT_ID"), ENV.fetch("ANYOAUTH_CLIENT_SECRET", "YOUR_CLIENT_SECRET"), ENV.fetch("ANYOAUTH_API_ORIGIN", "https://api.anyoauth.com"))
challenge = client.pkce_challenge({"codeVerifier" => ENV.fetch("ANYOAUTH_CODE_VERIFIER", "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk")})
gem install anyoauth-sdkConfidential backend SDKPublished 0.1.0 API
using System;
using System.Text.Json.Nodes;
using AnyOAuth;
var challenge = Client.PkceChallenge(Environment.GetEnvironmentVariable("ANYOAUTH_CODE_VERIFIER") ?? "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk");
dotnet add reference /path/to/anyoauth/sdks/dotnet/AnyOAuth.SDK.csprojConfidential backend SDKCurrent source example
use anyoauth_sdk::*;
use serde_json::json;
fn env(key: &str, fallback: &str) -> String { std::env::var(key).unwrap_or_else(|_| fallback.to_owned()) }
fn main() -> Result<(), Box<dyn std::error::Error>> {
let challenge = pkce_challenge(&env("ANYOAUTH_CODE_VERIFIER", "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"))?;
let _ = &challenge;
Ok(())
}
cargo add anyoauth-sdkConfidential backend SDKPublished 0.1.0 API
client = AnyOAuth.new((System.get_env("ANYOAUTH_CLIENT_ID") || "YOUR_CLIENT_ID"), (System.get_env("ANYOAUTH_CLIENT_SECRET") || "YOUR_CLIENT_SECRET"), (System.get_env("ANYOAUTH_API_ORIGIN") || "https://api.anyoauth.com"))
challenge = AnyOAuth.pkce_challenge(client, %{"codeVerifier" => (System.get_env("ANYOAUTH_CODE_VERIFIER") || "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk")})
mix.exs: {:anyoauth_sdk, "~> 0.1"}Confidential backend SDKPublished 0.1.0 API
import Foundation
import AnyOAuth
func env(_ key: String, _ fallback: String) -> String { ProcessInfo.processInfo.environment[key] ?? fallback }
let client = try AnyOAuth(clientId: env("ANYOAUTH_CLIENT_ID", "YOUR_CLIENT_ID"), baseUrl: env("ANYOAUTH_API_ORIGIN", "https://api.anyoauth.com"))
let challenge = try client.pkceChallenge(env("ANYOAUTH_CODE_VERIFIER", "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"))
.package(url: "https://github.com/AnyOAuth/anyoauth-swift.git", exact: "0.1.0")Client helpers · backend exchange requiredCurrent source example
import com.anyoauth.*
fun env(key: String, fallback: String): String = System.getenv(key) ?: fallback
fun main() {
val client = AnyOAuth(env("ANYOAUTH_CLIENT_ID", "YOUR_CLIENT_ID"), env("ANYOAUTH_API_ORIGIN", "https://api.anyoauth.com"))
val challenge = client.pkceChallenge(env("ANYOAUTH_CODE_VERIFIER", "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"))
}
implementation("com.anyoauth:anyoauth-client:0.1.0")Client helpers · backend exchange requiredPublished 0.1.0 API
import 'dart:io';
import 'package:anyoauth_client/anyoauth_client.dart';
String env(String key, String fallback) => Platform.environment[key] ?? fallback;
void main() {
final client = AnyOAuth(clientId: env("ANYOAUTH_CLIENT_ID", "YOUR_CLIENT_ID"), baseUrl: env("ANYOAUTH_API_ORIGIN", "https://api.anyoauth.com"));
final challenge = client.pkceChallenge(env("ANYOAUTH_CODE_VERIFIER", "dBjftJeZ4CVP-mB92K27uhbUJU1p1r_wW1gFWFOEjXk"));
}
flutter pub add anyoauth_client --path /path/to/anyoauth/sdks/clients/flutterClient helpers · backend exchange requiredCurrent source example
Legacy flow: reject ambiguous callbacks
The API and SDK helpers reject duplicate state/code/error parameters and simultaneous code/error values. SDK callbacks must match the saved redirect rather than a callback destination supplied by the visitor.
Protect the post-login return page
A destination such as /billing is separate from the OAuth callback. Save an allowlisted
internal destination in your application session. Reject absolute URLs and
protocol-relative paths such as //attacker.example; never blindly redirect to a raw
returnTo query parameter. The AnyOAuth dashboard uses a fixed configured return origin.