Go、GraphQL、Javascriptで構築されたオープンソースの認証システム・「Authorizer」

Ads

Authorizer


AuthorizerはGo、GraphQL、Javascriptで構築されたオープンソースの認証システムです。SDKが用意されておりわずか3分の作業で手軽に導入する事が出来るそうです。

認証はSNS等を使ったログイン、ベーシック認証の他、マジックリンク認証もサポートされており、今後も追加される予定だそうです。

データベースはPostgres、MySQL、SQLiteなどをサポート。また、Heroku、Docker、Kubernetesなどもサポートされています。

Ads

例えばHerokuでデプロイし、以下のHTMLを貼り付ける事ですぐに認証システムを統合できます。

<script src="https://unpkg.com/@authorizerdev/authorizer-js/lib/authorizer.min.js"></script>

<script type="text/javascript">
  const authorizerRef = new authorizerdev.Authorizer({
    authorizerURL: `AUTHORIZER_URL`,//ここを編集
    redirectURL: window.location.origin,
  });

  // use the button selector as per your application
  const logoutBtn = document.getElementById("logout");
  logoutBtn.addEventListener("click", async function () {
    await authorizerRef.logout();
    window.location.href = "/";
  });

  async function onLoad() {
    const res = await authorizerRef.browserLogin();
    if (res && res.user) {
      // you can use user information here, eg:
      /**
      const userSection = document.getElementById('user');
      const logoutSection = document.getElementById('logout-section');
      logoutSection.classList.toggle('hide');
      userSection.innerHTML = `Welcome, ${res.user.email}`;
      */
    }
  }
  onLoad();
</script>

開発者はセキュリティ、認証、パフォーマンスなどでこれまで多くのストレスを抱えてきたそうで、このシステムを公開する事で他の誰かの問題を解決し、その人が開発に集中できるようにしたいと考えて提供しているそうです。ライセンスはMIT。

Authorizer

タイトルとURLをコピーしました