• Stars
    star
    211
  • Rank 186,349 (Top 4 %)
  • Language Svelte
  • License
    MIT License
  • Created almost 3 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Federated sign-in component for your web app (using Matrix)

Sign in with Matrix

Screen.Recording.2021-11-12.at.05.51.57.mov

Over 35 million Matrix users can't wait to use your app. Use this pre-built component to make federated sign-in a no-effort zero-brainer

Before you do, please try a demo

Like it? Click on "Sponsor", so i can keep making this stuff!

โœจ Featured on This Week in Matrix

Cool stuff

  • Based on svelte, vite and typescript
  • Fully customisable and ready to use (even commercially)
  • Extremely lightweight
  • Framework-agnostic
  • Superior User-Interface and User-Experience
  • Secure, requires no backend to function
  • Fully accessible, compliant with WCAG Accessibility Guidelines
  • Compliant with Matrix 1.0 Protocol spec

Install

Browser

ES Module

<script defer src="https://unpkg.com/signin-with-matrix@latest/dist/index.es.js"></script>

UMD

<script defer src="https://unpkg.com/signin-with-matrix@latest/dist/index.umd.js"></script>

NPM

npm i signin-with-matrix

Import into your application with

import signIn from 'signin-with-matrix'

Use

Add the two components to your HTML

<matrix-signin id="signin"></matrix-signin>
<matrix-signin-button target="signin">
  Sign in with Matrix
</matrix-signin-button>
  • <matrix-signin> is the modal window
  • <matrix-signin-button> is a button which toggles the modal

Spec

<matrix-signin>

HTML attributes

  • displayName (String), name that will be displayed in Matrix
  • title (String), modal title
  • homeserver (String), default home server

Example

<matrix-signin
  displayName="My app"
  title="Use my app with Matrix"
  homeserver="matrix.org">
</matrix-signin>

Methods

  • open(), opens the modal
  • close(), closes the modal
  • cancel(), cancels the modal (will send cancel event)
  • isSignedIn(), checks if user is signed in
  • getUser(), returns current user, returns Promise
  • signOut(), sign out, returns Promise

Events

  • open, when modal opens
  • cancel, when modal is cancelled
  • success, when login has succeeded (with user object)
  • error, when error occurs (with error object)
  • signout, when user signs out

Example

Vanilla HTML + JS

<matrix-signin id="signin"></matrix-signin>
<script>
  const signIn = document.querySelector('matrix-signin')
  signIn.addEventListener('success', ({ detail }) => {
    console.log(detail.user)
  })
</script>

Vue

<template>
  <matrix-signin @success="notify"></matrix-signin>
</template>

<script>
export default {
  methods: {
    notify (user) {
      alert(JSON.stringify(user))
    }
  }
}
</script>

Styling

CSS variables available to style

--matrix-signin-shim-background
--matrix-signin-shim-blur
--matrix-signin-dialog-background
--matrix-signin-dialog-border-color
--matrix-signin-dialog-shadow
--matrix-signin-dialog-text-color
--matrix-signin-dialog-icon-color
--matrix-signin-dialog-hover-color
--matrix-signin-dialog-error-color
--matrix-signin-dialog-form-background
--matrix-signin-dialog-button-background
--matrix-signin-dialog-button-color

<matrix-signin-button>

HTML attributes

  • target (String), id of the target <matrix-signin> component

Example

<matrix-signin-button target="signin">
  Sign in with Matrix
</matrix-signin-button>

Development

  1. Clone the repository
git clone https://github.com/mishushakov/signin-with-matrix.git
  1. Install dependencies
npm i
  1. Start dev server
npm run dev
  1. Build
npm run build

Acknowledgements

More Repositories

1

llm-scraper

Turn any webpage into structured data using LLMs
TypeScript
1,954
star
2

dialogflow-web-v2

Dialogflow Web Integration. Supports rich components
Vue
416
star
3

dialogflow-web

Web App for Dialogflow
Vue
137
star
4

dialogflow-sendgrid

๐Ÿ“ฎ Dialogflow + Sendgrid = AI Mailbox
Python
34
star
5

Polymer-Web-App-Template

Free HTML5 mobile-friendly Polymer Web App template, easy&quick installation
HTML
23
star
6

dialogflow-widget

Dialogflow widget for websites [DEPRECATED]
Vue
22
star
7

dialogflow-gateway-docs

๐Ÿ“„ Docs for Dialogflow Gateway
22
star
8

Material-Design-chrome-extension-template

Enjoy using the new MDL (Material Design Lite) powered template for creating your own chrome extension!
HTML
17
star
9

matrix-forms

Connect your forms to Matrix
JavaScript
14
star
10

floating-chat

A framework-agnostic floating chat window component written in Svelte
Svelte
14
star
11

syntaxer

Multi-backend syntax highlighter for Crystal
Crystal
13
star
12

ai-fun

The LLM-powered function builder for TypeScript
TypeScript
13
star
13

dialogflow-inbox

๐Ÿ“จ AI Mailbox, powered by Dialogflow
Python
10
star
14

g

๐Ÿงžโ€โ™‚๏ธ Google Assistant in every terminal!
Go
9
star
15

next-garph

TypeScript
8
star
16

df-btn

๐Ÿ’ฌ Dialogflow / Actions floating chat
JavaScript
7
star
17

GuitarLSTM-browser

GuitarLSTM browser runtime
Python
7
star
18

dialogflow-gateway-js

๐Ÿ”Œ Dialogflow V2 JS SDK for node and browser
TypeScript
5
star
19

fulfillment-tester

๐Ÿ‘ฉโ€๐Ÿ”ฌ Test your Dialogflow/Actions on Google fulfillments like never before
Go
5
star
20

Blockchain

โ›“ Blockchain implemented in TypeScript
TypeScript
4
star
21

gh-clone

One-line GitHub backup script
Shell
3
star
22

dodyn

๐Ÿงจ Dynamic DNS on DigitalOcean
Shell
2
star
23

pre-highlighted

Custom element that extends <pre> with syntax highlighting
JavaScript
2
star
24

servicebear

๐Ÿ”‘ Generates OAuth Tokens from Google's Service Accounts
Go
1
star
25

minizod

TypeScript
1
star