Cause:

When using Facebook to log in three ways, the valid OAuth jump URI project appears to only support HTTPS access, the local test will implement HTTPS

Mkcert is a small tool which is written in go language to generate local self-license book. It has a series of convenient features, such as cross-platform, easy to use, support multiple domain names, automatic trust CA and so on. It can be used for local development to quickly create HTTPS environment. Making is introduced: https://github.com/FiloSottil…

macOS

On macOS, use Homebrew

brew install mkcert
brew install nss # if you use Firefox
$mkcert - Install Created a new local CA 💥 The local CA is now installed in The System Trust Store! ⚡ The local CA is now installed in The Firefox Trust Store (requires Browser Restart)! 🦊 $mkcert example.com" *.example.com" example.com example.test localhost 127.0.0.1 ::1 Created a new certificate valid for the Following names 📜 - "example.com" - "example.com" - "example.com" - "example.test" - "localhost" - "127.0.0.1" - "::1" The Certificate is at "./example.com+5.pem" and the key at "./example.com+5-key.pem" ✅

Code development: add a middleware

package main import ( "github.com/gin-gonic/gin" "github.com/unrolled/secure" ) func main() { router := gin.Default() Router.use (LoadTls()) // Open port listening router.runtls (":8080", "localhost.pem", "localhost-key.pem") } func LoadTls() gin.HandlerFunc { return func(c *gin.Context) { middleware := secure.New(secure.Options{ SSLRedirect: true, SSLHost: "localhost:8000", }) err := middleware.Process(c.Writer, c.Request) if err ! = nil {// If an error occurs, please do not continue. Fmt.println (err) return} // Continue with c.next ()}}