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

next-auth-authsch-provider

v1.0.2

Published

An OAuth Provider for auth.sch.bme.hu for the popular auth plugin NextAuth.js

Downloads

8

Readme

NextAuth.js AuthSCH Provider

Github npm

This package provides an OAuth2 provider for NextAuth.js, integrating with the AuthSCH authentication service. AuthSCH is a centralized authentication service for students of the Budapest University of Technology and Economics (BME).

Installation

Install the package via npm:

npm install next-auth-authsch-provider

Configuration

To use the AuthSCH provider in your NextAuth.js setup, you'll need to configure it with the required parameters. Below is an example configuration.

Example with default scope

import NextAuth from "next-auth";
import AuthSCHProvider from "next-auth-authsch-provider";

export default NextAuth({
  ...
  providers: [
    AuthSCHProvider({
      clientId: process.env.AUTHSCH_CLIENT_ID,
      clientSecret: process.env.AUTHSCH_CLIENT_SECRET,
    }),
  ],
  ...
});

Example with custom scope

import NextAuth from "next-auth";
import AuthSCHProvider, { type AuthSCHProfile } from "next-auth-authsch-provider";

export default NextAuth({
  ...
  providers: [
    AuthSCHProvider({
      clientId: process.env.AUTHSCH_CLIENT_ID,
      clientSecret: process.env.AUTHSCH_CLIENT_SECRET,
      scope: "basic mail sn givenName displayName permanentaddress",
      profile(profile: AuthSCHProfile) {
        return {
          id: profile.internal_id,
          name: profile.displayName,
          email: profile.mail,
          address: profile.permanentaddress, // you also need to extend the User type to accept more fields
        };
      },
    }),
  ],
  ...
});

AuthSCH Profile

The AuthSCH profile provides a comprehensive set of user information. Here is an overview of the properties available:

  • internal_id (string): AuthSCH ID (max 36 characters).
  • displayName (string): Full name.
  • sn (string): Surname.
  • givenName (string): First name.
  • mail (string): Email address.
  • niifPersonOrgID (string | null): Neptun code (if linked).
  • linkedAccounts (object): Linked accounts (e.g., BME email, schacc username).
  • eduPersonEntitlement (array): Membership status in circles (leader/member/old member).
  • roomNumber (string | null): Dorm room number (if applicable).
  • mobile (string): Mobile number.
  • niifEduPersonAttendedCourse (array): Courses attended in the current semester.
  • entrants (object): Community entrants (fall and spring).
  • admembership (array): Group memberships in KSZK's Active Directory.
  • bmeunitscope (string): University affiliation (e.g., BME, BME_VIK).
  • permanentaddress (string): Permanent address.

Options

AuthSCHProfileOptions

The AuthSCHProfileOptions interface extends OAuthUserConfig and includes the following:

  • scope (string): Scope can be used to request additional information from the user. Default is basic mail sn givenName displayName.

Default Scope

If no scope is specified, the following default scopes are used: basic mail sn givenName displayName.

Further Information

For more detailed information on the AuthSCH API and the available scopes, visit the AuthSCH API documentation.

License

This project is licensed under the ISC License.


By using this provider, you can easily integrate AuthSCH authentication into your Next.js application with NextAuth.js. For any questions or issues, please refer to the official documentation or raise an issue in the repository.