Skip to content
Node: passportgithub.com/sahilkhaire/gox/auth

GetBasicUser

Overview ​

GetBasicUser returns the username set by Basic middleware.

Part of the auth package — Node.js analog: passport.

Signature ​

go
func GetBasicUser(c *goxhttp.Ctx) string

Compare: Node.js · Standard Go · gox ​

js
// Typical passport pattern in Node.js
go
// net/http middleware checking Authorization header
go
import "github.com/sahilkhaire/gox/auth"

user, pass, ok := auth.GetBasicUser(c)

Example ​

go
import "github.com/sahilkhaire/gox/auth"

user, pass, ok := auth.GetBasicUser(c)

Tips ​

Import github.com/sahilkhaire/gox/auth and call GetBasicUser directly. See the comparison below for the standard library equivalent.

Standard library alternative ​

gox wraps the Go standard library or a trusted dependency with Node-familiar naming. You can use the underlying library directly — see the package overview for escape hatches.

← Back to auth package overview

MIT Licensed · Built for Node.js developers moving to Go