Skip to content

orbforge/wails-service-logto

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Wails Service Logto

Wails V3 Service for Logto authentication

License-MIT GitHub release (latest by date including pre-releases) Go Reference

Overview

This package provides a Wails V3 Service to easily add Logto authentication to your application.

Installation

go get github.com/orbforge/wails-service-logto

Usage

Import

import wailslogto "github.com/orbforge/wails-service-logto"

Configure

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,
                },
            ),
        ),
    },
}

Use from JS via Wails Bindings

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);
});

API Reference

See the Go Reference for detailed API documentation.

License

License MIT

About

Wails V3 Service for Logto authentication

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages