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

@logto/connector-oauth

v1.5.0

Published

OAuth standard connector implementation.

Downloads

201

Readme

OAuth standard connector

The official Logto connector for OAuth 2.0 protocol.

Get started

The OAuth connector enables Logto's connection to an arbitrary social identity provider that supports OAuth 2.0 protocol.

ℹ️ Note

OAuth connector is a special kind of connector in Logto, you can add a few OAuth-protocol-based connectors.

Create your OAuth app

When you open this page, we believe you already know which social identity provider you want to connect to. The first thing to do is to confirm that the identity provider supports the OAuth protocol, which is a prerequisite for configuring a valid connector. Then, follow the identity provider's instructions to register and create the relevant app for OAuth authorization.

Configure your connector

We ONLY support "Authorization Code" grant type for security consideration and it can perfectly fit Logto's scenario.

clientId and clientSecret can be found at your OAuth apps details page.

clientId: The client ID is a unique identifier that identifies the client application during registration with the authorization server. This ID is used by the authorization server to verify the identity of the client application and to associate any authorized access tokens with that specific client application.

clientSecret: The client secret is a confidential key that is issued to the client application by the authorization server during registration. The client application uses this secret key to authenticate itself with the authorization server when requesting access tokens. The client secret is considered confidential information and should be kept secure at all times.

tokenEndpointAuthMethod: The token endpoint authentication method is used by the client application to authenticate itself with the authorization server when requesting access tokens. To discover supported methods, consult the token_endpoint_auth_methods_supported field available at the OAuth 2.0 service provider’s OpenID Connect discovery endpoint, or refer to the relevant documentation provided by the OAuth 2.0 service provider.

clientSecretJwtSigningAlgorithm (Optional): Only required when tokenEndpointAuthMethod is client_secret_jwt. The client secret JWT signing algorithm is used by the client application to sign the JWT that is sent to the authorization server during the token request.

scope: The scope parameter is used to specify the set of resources and permissions that the client application is requesting access to. The scope parameter is typically defined as a space-separated list of values that represent specific permissions. For example, a scope value of "read write" might indicate that the client application is requesting read and write access to a user's data.

You are expected to find authorizationEndpoint, tokenEndpoint and userInfoEndpoint in social vendor's documentation.

authenticationEndpoint: This endpoint is used to initiate the authentication process. The authentication process typically involves the user logging in and granting authorization for the client application to access their resources.

tokenEndpoint: This endpoint is used by the client application to obtain an access token that can be used to access the requested resources. The client application typically sends a request to the token endpoint with a grant type and authorization code to receive an access token.

userInfoEndpoint: This endpoint is used by the client application to obtain additional information about the user, such as their fullname, email address or profile picture. The user info endpoint is typically accessed after the client application has obtained an access token from the token endpoint.

Logto also provides a profileMap field that users can customize the mapping from the social vendors' profiles which are usually not standard. The keys are Logto's standard user profile field names and corresponding values should be social profiles' field names. In the current stage, Logto only concerns 'id', 'name', 'avatar', 'email', and 'phone' from social profiles, only 'id' is required and others are optional fields.

Nested Attributes

The profileMap also supports nested attributes. You can map nested properties from the social vendor's profile to Logto's standard user profile fields.

For example, if the social vendor's profile has nested attributes like the following:

{
  "id": "123456",
  "contact": {
    "email": "[email protected]",
    "phone": "123-456-7890"
  },
  "details": {
    "name": "Oct Cat",
    "avatar": {
      "url": "avatar.png"
    },
    "groups": ["group1", "group2", "group3"]
  }
}

You can configure the profileMap like this:

{
  "id": "id",
  "name": "details.name",
  "avatar": "details.avatar.url",
  "email": "contact.email",
  "phone": "contact.phone"
}

In this example, details.name, details.avatar.url, contact.email, and contact.phone are nested attributes in the social vendor's profile.

ℹ️ Note

We provided an OPTIONAL customConfig key to put your customize parameters. Each social identity provider could have their own variant on OAuth standard protocol. If your desired social identity provider strictly stick to OAuth standard protocol, the you do not need to care about customConfig.

Config types

| Name | Type | Required | |---------------------------|------------------------|----------| | authorizationEndpoint | string | true | | userInfoEndpoint | string | true | | clientId | string | true | | clientSecret | string | true | | tokenEndpointResponseType | enum | false | | responseType | string | false | | grantType | string | false | | tokenEndpoint | string | false | | scope | string | false | | customConfig | Record<string, string> | false | | profileMap | ProfileMap | false |

| ProfileMap fields | Type | Required | Default value | |-------------------|--------|----------|---------------| | id | string | false | id | | name | string | false | name | | avatar | string | false | avatar | | email | string | false | email | | phone | string | false | phone |

Reference