npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@otherpage/connect-next-siwop

v1.0.1

Published

Sign in With Other Page acts as a drop in replacement of other forms of authentication for your app. Using SIWOP enables your users to login once across all of your apps and bring their Other Page avatars and profile data with them.

Downloads

310

Readme

opconnect-next-siwop

Sign in With Other Page acts as a drop in replacement of other forms of authentication for your app. Using SIWOP enables your users to login once across all of your apps and bring their Other Page avatars and profile data with them.

SIWOP is based on a slightly modified version of the OAuth2 protocol, specifically designed to work along side standard Web3 wallet connections.

Read the Full documentation

Required Config

  • SESSION_SECRET — a randomly generated, strong password of at least 32 characters
  • NEXT_PUBLIC_SIWOP_CLIENT_ID - your client id obtained in the Other Page Community dashboard
  • SIWOP_CLIENT_SECRET - your client secret obtained in the Other Page Community dashboard
  • NEXT_PUBLIC_SIWOP_REDIRECT_URI - your redirect_uri, this must match what is defined for your client in the Other Page Community dashboard

Getting Started

1. Install the required dependencies

$ npm install @otherpage/connect-next-siwop

2. Configure the client and context

// utils/siwopClient.ts
import { configureClientSIWOP } from '@otherpage/connect-next-siwop';

const siwopClient = configureClientSIWOP({
  apiRoutePrefix: '/api/siwop', // Your API route directory
  clientId: process.env.NEXT_PUBLIC_SIWOP_CLIENT_ID as string, // Your SIWOP client ID
  redirectUri: process.env.NEXT_PUBLIC_SIWOP_REDIRECT_URI as string, // Your redirect URI
  scope: 'avatar.read wallets.read twitter.read', // Your desired scopes
});

...

<siwopClient.Provider>
  <OPConnectProvider>
    /* Your App */
  </OPConnectProvider>
</siwopClient.Provider>

3. Configure the required server API routes.

Create a file inside your Next API folder api/siwop/[...route].ts.

// api/siwop/[...route].ts
import { configureServerSideSIWOP } from '@otherpage/connect-next-siwop';

const siwopServer = configureServerSideSIWOP({
  config: {
    audience: 'yourdomain.com',
    clientId: process.env.NEXT_PUBLIC_SIWOP_CLIENT_ID,
    redirectUri: process.env.NEXT_PUBLIC_SIWOP_REDIRECT_URI,
    clientSecret: process.env.SIWOP_CLIENT_SECRET,
    scope: 'avatar.read wallets.read twitter.read', // Matching scopes
  },
  session: {
    cookieName: '_opc',
    password: process.env.SESSION_SECRET,
    cookieOptions: {
      secure: process.env.NODE_ENV === 'production',
      sameSite: process.env.NODE_ENV === 'production' ? 'strict' : 'lax',
    },
  },
});

export default siwopServer.apiRouteHandler

4. OPConnect Modal

After a user connects a wallet, it will now prompt the user to authenticate to your app using their Other Page account.

<ConnectButton />