mirror of https://github.com/veypi/OneAuth.git
feat: user fs auto auth cookie
parent
e819b138ae
commit
655af2fcb1
@ -0,0 +1,25 @@
|
||||
//
|
||||
// libs.go
|
||||
// Copyright (C) 2024 veypi <i@veypi.com>
|
||||
// 2024-11-04 21:50
|
||||
// Distributed under terms of the GPL license.
|
||||
//
|
||||
|
||||
package libs
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/veypi/OneBD/rest"
|
||||
)
|
||||
|
||||
func CorsAllowAny(x *rest.X) {
|
||||
origin := x.Request.Header.Get("Origin")
|
||||
x.Header().Set("Access-Control-Allow-Origin", origin)
|
||||
x.Header().Set("Access-Control-Allow-Credentials", "true")
|
||||
x.Header().Set("Access-Control-Allow-Methods", "POST, GET, OPTIONS, PUT, DELETE, PATCH, PROPFIND")
|
||||
x.Header().Set("Access-Control-Allow-Headers", "Accept, Content-Type, Content-Length, Accept-Encoding, X-CSRF-Token, Authorization, depth")
|
||||
if x.Request.Method == http.MethodOptions && x.Request.Header.Get("Access-Control-Request-Method") != "" {
|
||||
x.Stop()
|
||||
}
|
||||
}
|
@ -1,7 +1,15 @@
|
||||
import './style.css'
|
||||
import oaer from '../lib/main'
|
||||
|
||||
oaer.init('http://localhost:3000', '')
|
||||
// import { proxy } from '../lib/v2dom'
|
||||
// let a = proxy.Ref(1)
|
||||
// a.value++
|
||||
import oaer from '../lib/main'
|
||||
let code =
|
||||
`eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1aWQiOiI3ODA5YTZlNjhmNDE0OWM5ODFhMmFhNTI0NTE0MzIyZiIsImFpZCI6InRNUnhXejc3UDlBQk5aQTNaSXVvTlFJTGpWQkJJVWRmIiwibmFtZSI6ImFkbWluIiwiaWNvbiI6Imh0dHBzOi8vcHVibGljLnZleXBpLmNvbS9pbWcvYXZhdGFyLzAwNTEuanBnIiwiYWNjZXNzIjpudWxsLCJpc3MiOiJvYSIsImV4cCI6MTczMDk4NDY4MiwiaWF0IjoxNzMwNzI1NDgyLCJqdGkiOiIxOWZlZTc4YjQwN2M0ZTQ5OWI1Yjg2YmJjNTNjMTA2YyJ9.vIriE-L2AZLtigWXAXHrTG2_XIELqp0bAnFEBX0Hw8w`
|
||||
oaer.init('http://localhost:4000', code).then(e => {
|
||||
console.log(`login ${e.name}`)
|
||||
}).catch(() => {
|
||||
console.log('not login')
|
||||
})
|
||||
oaer.render_ui('voa')
|
||||
console.log(oaer)
|
||||
|
||||
|
Loading…
Reference in New Issue