oauth

package
v0.20.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 5, 2026 License: MIT Imports: 3 Imported by: 0

README

OAuth Sign-In

Helps human complete OAuth sign-in flows by handling the localhost callback that providers redirect you to after you log in. It spots the callback details in a login URL and can point them at a free port on your machine.

  • Detects the localhost redirect in a login URL
  • Reads the callback port and path
  • Captures the OAuth state parameter
  • Reroutes the callback to a chosen port
  • Preserves all other login URL parameters

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RewriteRedirectPort

func RewriteRedirectPort(rawURL string, newPort int) string

RewriteRedirectPort returns a copy of rawURL with the redirect_uri's port replaced by newPort. If the URL cannot be parsed or has no redirect_uri, the original URL is returned unchanged.

Types

type RedirectInfo

type RedirectInfo struct {
	Port  int    // e.g. 38599
	Path  string // e.g. "/callback"
	State string // expected state parameter; empty when the request had none
}

RedirectInfo contains the parsed localhost redirect target from an OAuth URL.

func DetectRedirect

func DetectRedirect(rawURL string) *RedirectInfo

DetectRedirect parses rawURL looking for a redirect_uri query parameter that targets localhost. Returns nil if no such redirect is found.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL