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

@octokit-next/oauth-authorization-url

v2.8.0

Published

Universal library to retrieve GitHub’s identity URL for the OAuth web flow

Downloads

98

Readme

oauth-authorization-url.js

Universal library to retrieve GitHub’s identity URL for the OAuth web flow

@latest Build Status

See GitHub’s Developer Guide for the OAuth App web application flow. Note that the OAuth web application flow for GitHub Apps is slightly different. GitHub Apps do not support scopes for its user access tokens (they are called user-to-server tokens for GitHub Apps), instead they inherit the user permissions from the GitHub App's registration and the repository/organization access and permissions from the respective installation.

Usage

Load @octokit-next/oauth-authorization-url directly from cdn.skypack.dev

<script type="module">
  import { oauthAuthorizationUrl } from "https://cdn.skypack.dev/@octokit-next/oauth-authorization-url";
</script>

Install with npm install @octokit/oauth-next-authorization-url

import { oauthAuthorizationUrl } from "@octokit-next/oauth-authorization-url";

Deno

Load @octokit-next/oauth-next-authorization-url directly from cdn.skypack.dev, including types.

import { oauthAuthorizationUrl } from "https://cdn.skypack.dev/@octokit-next/oauth-next-authorization-url?dts";

For OAuth Apps

const { url, clientId, redirectUrl, login, scopes, state } =
  oauthAuthorizationUrl({
    clientType: "oauth-app",
    clientId: "1234567890abcdef1234",
    redirectUrl: "https://example.com",
    login: "octocat",
    scopes: ["repo", "admin:org"],
    state: "secret123",
  });

For GitHub Apps

const { url, clientId, redirectUrl, login, state } = oauthAuthorizationUrl({
  clientType: "github-app",
  clientId: "lv1.1234567890abcdef",
  redirectUrl: "https://example.com",
  login: "octocat",
  state: "secret123",
});

Options

Must be set to either "oauth-app" or "github-app". Defaults to "oauth-app".

Only relevant when clientType is set to "oauth-app".

An array of scope names (or: space-delimited list of scopes). If not provided, scope defaults to an empty list for users that have not authorized any scopes for the application. For users who have authorized scopes for the application, the user won't be shown the OAuth authorization page with the list of scopes. Instead, this step of the flow will automatically complete with the set of scopes the user has authorized for the application. For example, if a user has already performed the web flow twice and has authorized one token with user scope and another token with repo scope, a third web flow that does not provide a scope will receive a token with user and repo scope.

Defaults to [] if clientType is set to "oauth-app".

Result

oauthAuthorizationUrl() returns an object with the following properties

Only set if options.clientType is set to "oauth-app".

Returns an array of strings. Returns options.scopes if it was set and turns the string into an array if a string was passed, otherwise [].

Types

import {
  ClientType,
  OAuthAppOptions,
  OAuthAppResult,
  GitHubAppOptions,
  GitHubAppResult,
} from "@octokit-next/oauth-authorization-url";

License

MIT