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

ame-pass-auth

v0.1.5

Published

Authentication package for GamePass with Google Sign-in support for Next.js, Vite, and React

Downloads

7

Readme

GamePass Auth

A beautiful, customizable authentication package for React, Next.js, and Vite with Google Sign-in support.

Features

  • 🎨 Fully customizable colors and styling
  • 🔐 Google OAuth integration
  • ⚡ Works with Next.js, Vite, and React
  • 📱 Responsive modal design
  • 🎮 Gaming-themed UI
  • 🔧 TypeScript support

Installation

npm install game-pass-auth
# or
yarn add game-pass-auth
# or
pnpm add game-pass-auth

Setup

1. Get Google Client ID

  1. Go to Google Cloud Console
  2. Create a new project or select existing
  3. Enable Google+ API
  4. Create OAuth 2.0 credentials
  5. Add authorized JavaScript origins (e.g., http://localhost:3000)
  6. Copy your Client ID

2. Wrap Your App with Provider

Next.js (App Router) - app/layout.tsx:

import { GamePassProvider } from 'game-pass-auth';
import 'game-pass-auth/dist/esm/styles/modal.css';

export default function RootLayout({ children }) {
  return (
    <html lang="en">
      <body>
        <GamePassProvider
          googleClientId="YOUR_GOOGLE_CLIENT_ID"
          onSuccess={(user) => {
            console.log('User logged in:', user);
          }}
          onError={(error) => {
            console.error('Auth error:', error);
          }}
        >
          {children}
        </GamePassProvider>
      </body>
    </html>
  );
}

Next.js (Pages Router) - pages/_app.tsx:

import { GamePassProvider } from 'game-pass-auth';
import 'game-pass-auth/dist/esm/styles/modal.css';
import type { AppProps } from 'next/app';

export default function App({ Component, pageProps }: AppProps) {
  return (
    <GamePassProvider
      googleClientId="YOUR_GOOGLE_CLIENT_ID"
      onSuccess={(user) => console.log('User:', user)}
      onError={(error) => console.error('Error:', error)}
    >
      <Component {...pageProps} />
    </GamePassProvider>
  );
}

Vite/React - main.tsx:

import React from 'react';
import ReactDOM from 'react-dom/client';
import { GamePassProvider } from 'game-pass-auth';
import 'game-pass-auth/dist/esm/styles/modal.css';
import App from './App';

ReactDOM.createRoot(document.getElementById('root')!).render(
  <React.StrictMode>
    <GamePassProvider
      googleClientId="YOUR_GOOGLE_CLIENT_ID"
      onSuccess={(user) => console.log('User:', user)}
      onError={(error) => console.error('Error:', error)}
    >
      <App />
    </GamePassProvider>
  </React.StrictMode>
);

Usage

Basic Example

'use client'; // Only needed for Next.js App Router

import { useState } from 'react';
import { AuthModal, AuthButton } from 'game-pass-auth';

export default function HomePage() {
  const [isModalOpen, setIsModalOpen] = useState(false);

  return (
    <div>
      <AuthButton
        onClick={() => setIsModalOpen(true)}
        label="Sign In to GamePass"
      />

      <AuthModal
        isOpen={isModalOpen}
        onClose={() => setIsModalOpen(false)}
        title="Welcome to GamePass"
        imageUrl="https://example.com/logo.png"
      />
    </div>
  );
}

Customized Colors

<AuthModal
  isOpen={isModalOpen}
  onClose={() => setIsModalOpen(false)}
  title="Join Our Gaming Community"
  imageUrl="https://example.com/game-logo.png"
  primaryColor="#ff6b6b"
  secondaryColor="#ee5a52"
  textColor="#ffffff"
/>

<AuthButton
  onClick={() => setIsModalOpen(true)}
  label="# GamePass Auth

A beautiful, customizable authentication package for React, Next.js, and Vite with Google Sign-in support.

## Features

- 🎨 Fully customizable colors and styling
- 🔐 Google OAuth integration
- ⚡ Works with Next.js, Vite, and React
- 📱 Responsive modal design
- 🎮 Gaming-themed UI
- 🔧 TypeScript support

## Installation

```bash
npm install game-pass-auth
# or
yarn add game-pass-auth
# or
pnpm add game-pass-auth

Setup

1. Get Google Client ID

  1. Go to Google Cloud Console
  2. Create a new project or select existing
  3. Enable Google+ API
  4. Create OAuth 2.0 credentials
  5. Add authorized JavaScript origins (e.g., http://localhost:3000)
  6. Copy your Client ID

2. Wrap Your App with Provider

Next.js (App Router) - app/layout.tsx:

import { GamePassProvider } from 'game-pass-auth';
import 'game-pass-auth/dist/esm/styles/modal.css';

export default function RootLayout({ children }) {
  return (
    <html lang="en">
      <body>
        <GamePassProvider
          googleClientId="YOUR_GOOGLE_CLIENT_ID"
          onSuccess={(user) => {
            console.log('User logged in:', user);
          }}
          onError={(error) => {
            console.error('Auth error:', error);
          }}
        >
          {children}
        </GamePassProvider>
      </body>
    </html>
  );
}

Next.js (Pages Router) - pages/_app.tsx:

import { GamePassProvider } from 'game-pass-auth';
import 'game-pass-auth/dist/esm/styles/modal.css';
import type { AppProps } from 'next/app';

export default function App({ Component, pageProps }: AppProps) {
  return (
    <GamePassProvider
      googleClientId="YOUR_GOOGLE_CLIENT_ID"
      onSuccess={(user) => console.log('User:', user)}
      onError={(error) => console.error('Error:', error)}
    >
      <Component {...pageProps} />
    </GamePassProvider>
  );
}

Vite/React - main.tsx:

import React from 'react';
import ReactDOM from 'react-dom/client';
import { GamePassProvider } from 'game-pass-auth';
import 'game-pass-auth/dist/esm/styles/modal.css';
import App from './App';

ReactDOM.createRoot(document.getElementById('root')!).render(
  <React.StrictMode>
    <GamePassProvider
      googleClientId="YOUR_GOOGLE_CLIENT_ID"
      onSuccess={(user) => console.log('User:', user)}
      onError={(error) => console.error('Error:', error)}
    >
      <App />
    </GamePassProvider>
  </React.StrictMode>
);

Usage

Basic Example

'use client'; // Only needed for Next.js App Router

import { useState } from 'react';
import { AuthModal, AuthButton } from 'game-pass-auth';

export default function HomePage() {
  const [isModalOpen, setIsModalOpen] = useState(false);

  return (
    <div>
      <AuthButton
        onClick={() => setIsModalOpen(true)}
        label="Sign In to GamePass"
      />

      <AuthModal
        isOpen={isModalOpen}
        onClose={() => setIsModalOpen(false)}
        title="Welcome to GamePass"
        imageUrl="https://example.com/logo.png"
      />
    </div>
  );
}

Customized Colors

<AuthModal
  isOpen={isModalOpen}
  onClose={() => setIsModalOpen(false)}
  title="Join Our Gaming Community"
  imageUrl="https://example.com/game-logo.png"
  primaryColor="#ff6b6b"
  secondaryColor="#ee5a52"
  textColor="#ffffff"
/>

<AuthButton
  onClick={() => setIsModalOpen(true)}
  label="Get Started"
  primaryColor="#ff6b6b"
  textColor="#ffffff"
/>

API Reference

GamePassProvider Props

| Prop | Type | Required | Description | |------|------|----------|-------------| | googleClientId | string | Yes | Your Google OAuth Client ID | | onSuccess | (user: GoogleUser) => void | No | Callback when user successfully authenticates | | onError | (error: Error) => void | No | Callback when authentication fails | | children | ReactNode | Yes | Your app components |

AuthModal Props

| Prop | Type | Required | Default | Description | |------|------|----------|---------|-------------| | isOpen | boolean | Yes | - | Controls modal visibility | | onClose | () => void | Yes | - | Callback to close modal | | title | string | No | "Welcome to GamePass" | Modal title | | imageUrl | string | No | - | Logo/image URL (80x80px recommended) | | primaryColor | string | No | "#6366f1" | Primary button and accent color | | secondaryColor | string | No | "#4f46e5" | Secondary accent color | | textColor | string | No | "#ffffff" | Button text color |

AuthButton Props

| Prop | Type | Required | Default | Description | |------|------|----------|---------|-------------| | onClick | () => void | Yes | - | Click handler | | label | string | No | "Sign In" | Button text | | primaryColor | string | No | "#6366f1" | Button background color | | textColor | string | No | "#ffffff" | Button text color | | className | string | No | "" | Additional CSS classes |

GoogleUser Type

interface GoogleUser {
  email: string;
  name: string;
  picture: string;
  sub: string; // Google user ID
}

Complete Next.js Example

Here's a full working example for Next.js App Router:

app/layout.tsx:

import { GamePassProvider } from 'game-pass-auth';
import 'game-pass-auth/dist/esm/styles/modal.css';
import './globals.css';

export default function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
  return (
    <html lang="en">
      <body>
        <GamePassProvider
          googleClientId={process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID!}
          onSuccess={(user) => {
            console.log('Welcome:', user.name);
            // Save user to database, set cookies, etc.
          }}
          onError={(error) => {
            console.error('Authentication failed:', error);
          }}
        >
          {children}
        </GamePassProvider>
      </body>
    </html>
  );
}

app/page.tsx:

'use client';

import { useState } from 'react';
import { AuthModal, AuthButton } from 'game-pass-auth';

export default function Home() {
  const [isModalOpen, setIsModalOpen] = useState(false);

  return (
    <main className="min-h-screen flex items-center justify-center bg-gray-900">
      <div className="text-center">
        <h1 className="text-4xl font-bold text-white mb-8">
          Welcome to Our Gaming Platform
        </h1>
        
        <AuthButton
          onClick={() => setIsModalOpen(true)}
          label="Sign In with GamePass"
          primaryColor="#8b5cf6"
          textColor="#ffffff"
        />

        <AuthModal
          isOpen={isModalOpen}
          onClose={() => setIsModalOpen(false)}
          title="Join GamePass"
          imageUrl="/gamepass-logo.png"
          primaryColor="#8b5cf6"
          secondaryColor="#7c3aed"
          textColor="#ffffff"
        />
      </div>
    </main>
  );
}

.env.local:

NEXT_PUBLIC_GOOGLE_CLIENT_ID=your_google_client_id_here

Styling Customization

The package includes default styles, but you can override them:

/* In your global CSS file */
.gamepass-modal {
  border-radius: 30px;
}

.gamepass-title {
  font-family: 'Your Custom Font', sans-serif;
}

Building the Package

  1. Clone the repository
  2. Install dependencies: npm install
  3. Build: npm run build
  4. The package will be built to dist/ directory

Publishing to NPM

npm login
npm publish

Development

npm run dev  # Watch mode for development
npm run build  # Production build

TypeScript

The package is written in TypeScript and includes type definitions. No additional setup needed!

Browser Support

  • Chrome (latest)
  • Firefox (latest)
  • Safari (latest)
  • Edge (latest)

License

MIT

Support

For issues and questions, please open an issue on GitHub.


Powered by GamePass 🎮