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 🙏

© 2025 – Pkg Stats / Ryan Hefner

parse-server-x-auth-adapter

v0.1.0

Published

Parse server auth adapter to sign with x.com

Readme

X (Twitter) Auth Adapter for Parse Server

The X (Twitter) Auth Adapter integrates seamlessly with Parse Server to enable authentication using X (formerly Twitter) accounts. This adapter facilitates secure user authentication leveraging X's OAuth 2.0 Authorization Code Flow with PKCE (Proof Key for Code Exchange) protocol.

Features

  • X/Twitter Authentication: Allow users to sign up and log in using their X accounts via OAuth 2.0 with PKCE.
  • Secure Token Validation: Verifies the access token provided by X after the PKCE flow to ensure authenticity.
  • Profile Data Integration: Can potentially fetch basic user profile data from X upon successful authentication using the obtained access token.

Installation

The X Auth Adapter is part of the @parseauthkit/auth-adapters package. Ensure this package is installed in your Parse Server project:

npm install @parseauthkit/auth-adapters
# or
yarn add @parseauthkit/auth-adapters

Configuration

To use the X Auth Adapter in your Parse Server, register it within the auth section of your Parse Server options. Typically, OAuth 2.0 with PKCE requires client-side handling of the flow and doesn't necessitate specific server-side API keys (like consumer keys) within the adapter configuration itself. The validation relies on the access token provided by the client after completing the PKCE flow.

import { initializeXAdapter } from "@parseauthkit/auth-adapters";

const xAdapter = initializeXAdapter();

const api = new ParseServer({
  // ... other Parse Server config (appId, masterKey, serverURL, etc.)
  auth: {
    x: xAdapter, // Register the adapter with the key 'x'
    // ... other adapters
  },
});

Make sure your X Application is configured correctly in the Twitter Developer Portal with the appropriate Client ID, Callback URI(s), and enabled for OAuth 2.0.

Usage

Integrating X authentication with OAuth 2.0 PKCE involves these client-side steps:

  1. Generate Code Verifier & Challenge: Create a cryptographically random code_verifier and derive the code_challenge (using SHA256).
  2. Initiate OAuth Flow: Redirect the user to X's OAuth 2.0 authorization URL (https://twitter.com/i/oauth2/authorize), including parameters like response_type=code, client_id, redirect_uri, scope, state, code_challenge, and code_challenge_method=S256.
  3. Receive Authorization Code: After the user authorizes your application, X redirects back to your redirect_uri with an authorization_code and the state.
  4. Exchange Code for Tokens: Your client-side application makes a POST request to X's token endpoint (https://api.twitter.com/2/oauth2/token), providing the authorization_code, grant_type=authorization_code, client_id, redirect_uri, and the original code_verifier.
  5. Receive Tokens: X responds with an access_token, refresh_token (if applicable), scope, and expires_in. You'll likely need to make a separate request to https://api.twitter.com/2/users/me using the access_token to get the user's ID and screen name.
  6. Authenticate with Parse Server: Use the obtained access_token and the user's X id (retrieved in the previous step) to authenticate with your Parse Server via the linkWith or logInWith method from the Parse SDK.

For a complete implementation example including token exchange and OAuth provider configuration, please refer to the README.md file.

Note: The exact authData fields required by the @parseauthkit/auth-adapters adapter are id (the user's unique X ID) and access_token (obtained via the OAuth 2.0 PKCE flow). Refer to the adapter's source code or type definitions for any additional optional fields.