GitHubAdapter

new GitHubAdapter(options, authData)

Parse Server Configuration

  • To configure Parse Server for GitHub authentication, use the following structure:
{
 "auth": {
  "github": {
    "clientId": "12345",
    "clientSecret": "abcde"
  }
}

The GitHub adapter exchanges the authData.code provided by the client for an access token using GitHub's OAuth API. The following authData field is required:

  • code

Insecure Authentication (Not Recommended)

Insecure authentication uses the authData.id and authData.access_token provided by the client. This flow is insecure, deprecated, and poses potential security risks. The following authData fields are required:

  • id ([DEPRECATED]): The GitHub user ID.
  • access_token ([DEPRECATED]): The GitHub access token. To configure Parse Server for insecure authentication, use the following structure:
{
 "auth": {
   "github": {
   "enableInsecureAuth": true
 }
}

Deprecation Notice

The enableInsecureAuth option and insecure authData fields (id, access_token) are deprecated and will be removed in future versions. Use secure authentication with clientId and clientSecret.

Parameters:
NameTypeDescription
optionsObject

The adapter configuration options.

Properties
NameTypeAttributesDefaultDescription
clientIdstring

The GitHub App Client ID. Required for secure authentication.

clientSecretstring

The GitHub App Client Secret. Required for secure authentication.

enableInsecureAuthboolean<optional>
false

[DEPRECATED] Enable insecure authentication (not recommended).

authDataObject

The authentication data provided by the client.

Properties
NameTypeAttributesDescription
codestring

The authorization code from GitHub. Required for secure authentication.

idstring<optional>

[DEPRECATED] The GitHub user ID (required for insecure authentication).

access_tokenstring<optional>

[DEPRECATED] The GitHub access token (required for insecure authentication).

Examples

Secure Authentication Example

// Example authData for secure authentication:
const authData = {
  github: {
    code: "abc123def456ghi789"
  }
};

Insecure Authentication Example (Not Recommended)

// Example authData for insecure authentication:
const authData = {
  github: {
    id: "1234567",
    access_token: "abc123def456ghi789" // Deprecated.
  }
};