Wails V3 Service for Logto authentication
This package provides a Wails V3 Service to easily add Logto authentication to your application.
go get github.com/orbforge/wails-service-logto
import wailslogto "github.com/orbforge/wails-service-logto"
application.Options{
Services: []application.Service{
application.NewService(
wailslogto.New(
&wailslogto.Config{
RedirectAddresses: []logto.RedirectURIs{
// ensure these addresses are added to your configuration in Logto
{
SignIn: "http://127.0.0.1:5447/auth/callback",
SignOut: "http://127.0.0.1:5447/auth/callback",
},
// optionally, you can add fallback listener addresses
{
SignIn: "http://127.0.0.1:5448/auth/callback",
SignOut: "http://127.0.0.1:5448/auth/callback",
},
},
LogToConfig: &client.LogtoConfig{
Endpoint: "https://your-logto.endpoint.net/",
AppId: "your-app-id",
},
WindowOptions: application.WebviewWindowOptions{
Title: "Example Sign In",
},
// optional maximum time to wait for the user to sign in before
// closing the sign-in window and callback listener
AuthTimeout: 5 * time.Minute,
},
),
),
},
}
import { SignIn } from '../../bindings/github.com/orbforge/wails-service-logto';
// Sign in
SignIn().then(() => {
console.log('Signed in');
}).catch((err) => {
console.error('Failed to sign in', err);
});
See the Go Reference for detailed API documentation.