Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: adonisjs/ally
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v5.0.0-4
Choose a base ref
...
head repository: adonisjs/ally
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: develop
Choose a head ref

Commits on Sep 27, 2023

  1. chore(release): 5.0.0-4

    thetutlage committed Sep 27, 2023
    Copy the full SHA
    23d7acb View commit details
  2. chore(release): 5.0.0-5

    thetutlage committed Sep 27, 2023
    Copy the full SHA
    11e584d View commit details

Commits on Oct 19, 2023

  1. chore: update dependencies

    thetutlage committed Oct 19, 2023
    Copy the full SHA
    c9b5a5c View commit details
  2. Copy the full SHA
    c1e0bc1 View commit details
  3. Copy the full SHA
    a73d9ec View commit details
  4. chore(release): 5.0.0-6

    thetutlage committed Oct 19, 2023
    Copy the full SHA
    56f910c View commit details

Commits on Nov 27, 2023

  1. chore: update dependencies

    thetutlage committed Nov 27, 2023
    Copy the full SHA
    162e097 View commit details
  2. Copy the full SHA
    3c3dd51 View commit details
  3. Copy the full SHA
    efaef26 View commit details
  4. chore(release): 5.0.0-7

    thetutlage committed Nov 27, 2023
    Copy the full SHA
    963d0df View commit details

Commits on Dec 24, 2023

  1. chore: update dependencies

    thetutlage committed Dec 24, 2023
    Copy the full SHA
    16951f7 View commit details
  2. Copy the full SHA
    20d64e0 View commit details
  3. Copy the full SHA
    f66354d View commit details
  4. docs: update description

    thetutlage committed Dec 24, 2023
    Copy the full SHA
    5f081db View commit details
  5. chore(release): 5.0.0-8

    thetutlage committed Dec 24, 2023
    Copy the full SHA
    74412a5 View commit details

Commits on Jan 9, 2024

  1. Copy the full SHA
    7bffd15 View commit details
  2. Copy the full SHA
    1205160 View commit details
  3. Copy the full SHA
    13dd711 View commit details
  4. Merge pull request #147 from adonisjs/next

    Merge to develop for final release
    thetutlage authored Jan 9, 2024
    Copy the full SHA
    d0bf607 View commit details
  5. Copy the full SHA
    927d148 View commit details
  6. chore(release): 5.0.0

    thetutlage committed Jan 9, 2024
    Copy the full SHA
    525c868 View commit details

Commits on Jan 20, 2024

  1. Copy the full SHA
    a10fcd9 View commit details
  2. chore(release): 5.0.1

    RomainLanz committed Jan 20, 2024
    Copy the full SHA
    2786de8 View commit details

Commits on Jan 23, 2024

  1. chore: update dependencies

    thetutlage committed Jan 23, 2024
    Copy the full SHA
    825e402 View commit details
  2. Copy the full SHA
    5336914 View commit details
  3. chore(release): 5.0.2

    thetutlage committed Jan 23, 2024
    Copy the full SHA
    5c03948 View commit details

Commits on Feb 29, 2024

  1. docs(README): update link to docs (#149)

    Co-authored-by: Paul Nallet <paul@copromatic.com>
    paul-nallet and Paul Nallet authored Feb 29, 2024
    Copy the full SHA
    17468c6 View commit details

Commits on Jun 1, 2024

  1. Copy the full SHA
    6bb90d5 View commit details

Commits on Jun 17, 2024

  1. Copy the full SHA
    07e4ce8 View commit details
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -2,13 +2,13 @@

<br />

[![gh-workflow-image]][gh-workflow-url] [![npm-image]][npm-url] ![][typescript-image] [![license-image]][license-url] [![snyk-image]][snyk-url]
[![gh-workflow-image]][gh-workflow-url] [![npm-image]][npm-url] ![][typescript-image] [![license-image]][license-url]

## Introduction
Social authentication provider for AdonisJS. Supports *Github*, Google, Twitter, Facebook, Discord, Spotify, and LinkedIn.
Social authentication provider for AdonisJS. Supports **Github**, **Google**, **Twitter**, **Facebook**, **Discord**, **Spotify**, and **LinkedIn**.

## Official Documentation
The documentation is available on the [AdonisJS website](https://docs.adonisjs.com/guides/auth/social)
The documentation is available on the [AdonisJS website](https://docs.adonisjs.com/guides/social-auth)

## Contributing
One of the primary goals of AdonisJS is to have a vibrant community of users and contributors who believes in the principles of the framework.
@@ -21,8 +21,8 @@ In order to ensure that the AdonisJS community is welcoming to all, please revie
## License
AdonisJS ally is open-sourced software licensed under the [MIT license](LICENSE.md).

[gh-workflow-image]: https://img.shields.io/github/actions/workflow/status/adonisjs/ally/test.yml?style=for-the-badge
[gh-workflow-url]: https://github.com/adonisjs/ally/actions/workflows/test.yml "Github action"
[gh-workflow-image]: https://img.shields.io/github/actions/workflow/status/adonisjs/ally/checks.yml?style=for-the-badge
[gh-workflow-url]: https://github.com/adonisjs/ally/actions/workflows/checks.yml "Github action"

[npm-image]: https://img.shields.io/npm/v/@adonisjs/ally/latest.svg?style=for-the-badge&logo=npm
[npm-url]: https://www.npmjs.com/package/@adonisjs/ally/v/latest "npm"
@@ -31,6 +31,3 @@ AdonisJS ally is open-sourced software licensed under the [MIT license](LICENSE.

[license-url]: LICENSE.md
[license-image]: https://img.shields.io/github/license/adonisjs/ally?style=for-the-badge

[snyk-image]: https://img.shields.io/snyk/vulnerabilities/github/adonisjs/ally?label=Snyk%20Vulnerabilities&style=for-the-badge
[snyk-url]: https://snyk.io/test/github/adonisjs/ally?targetFile=package.json "snyk"
62 changes: 55 additions & 7 deletions configure.ts
Original file line number Diff line number Diff line change
@@ -8,27 +8,75 @@
*/

import type Configure from '@adonisjs/core/commands/configure'
import { stubsRoot } from './stubs/main.js'

/**
* List of available providers
*/
const AVAILABLE_PROVIDERS = [
'discord',
'facebook',
'github',
'google',
'linkedin',
'spotify',
'twitter',
]

/**
* Configures the package
*/
export async function configure(command: Configure) {
const providers = await command.prompt.multiple(
'Select the social auth providers you plan to use',
['discord', 'facebook', 'github', 'google', 'linkedin', 'spotify', 'twitter']
)
/**
* Read providers from the CLI flags
*/
let selectedProviders: string[] | string | undefined = command.parsedFlags.providers

/**
* Otherwise force prompt for selection
*/
if (!selectedProviders) {
selectedProviders = await command.prompt.multiple(
'Select the social auth providers you plan to use',
AVAILABLE_PROVIDERS,
{
validate(value) {
return !value || !value.length
? 'Select a social provider to configure the package'
: true
},
}
)
}

/**
* Cast CLI string value to an array
*/
let providers = (
typeof selectedProviders === 'string' ? [selectedProviders] : selectedProviders
) as string[]

/**
* Validate CLI selection to contain known providers
*/
const unknownProvider = providers.find((provider) => !AVAILABLE_PROVIDERS.includes(provider))
if (unknownProvider) {
command.exitCode = 1
command.logger.error(`Invalid social provider "${unknownProvider}"`)
return
}

const codemods = await command.createCodemods()

/**
* Publish config file
*/
await command.publishStub('config.stub', {
await codemods.makeUsingStub(stubsRoot, 'config/ally.stub', {
providers: providers.map((provider) => {
return { provider, envPrefix: provider.toUpperCase() }
}),
})

const codemods = await command.createCodemods()

/**
* Publish provider
*/
38 changes: 15 additions & 23 deletions examples/config/ally.ts
Original file line number Diff line number Diff line change
@@ -1,52 +1,44 @@
import { defineConfig } from '../../src/define_config.js'
import { defineConfig, services } from '../../index.js'

const allyConfig = defineConfig({
discord: {
driver: 'discord',
discord: services.discord({
clientId: process.env.DISCORD_CLIENT_ID!,
clientSecret: process.env.DISCORD_CLIENT_SECRET!,
callbackUrl: `http://localhost:${process.env.PORT}/discord/callback`,
},
google: {
driver: 'google',
}),
google: services.google({
clientId: process.env.GOOGLE_CLIENT_ID!,
clientSecret: process.env.GOOGLE_CLIENT_SECRET!,
callbackUrl: `http://localhost:${process.env.PORT}/google/callback`,
},
github: {
driver: 'github',
}),
github: services.github({
clientId: process.env.GITHUB_CLIENT_ID!,
clientSecret: process.env.GITHUB_CLIENT_SECRET!,
callbackUrl: `http://localhost:${process.env.PORT}/github/callback`,
},
linkedin: {
driver: 'linkedin',
}),
linkedin: services.linkedin({
clientId: process.env.LINKEDIN_CLIENT_ID!,
clientSecret: process.env.LINKEDIN_CLIENT_SECRET!,
callbackUrl: `http://localhost:${process.env.PORT}/linkedin/callback`,
},
twitter: {
driver: 'twitter',
}),
twitter: services.twitter({
clientId: process.env.TWITTER_API_KEY!,
clientSecret: process.env.TWITTER_APP_SECRET!,
callbackUrl: `http://localhost:${process.env.PORT}/twitter/callback`,
},
facebook: {
driver: 'facebook',
}),
facebook: services.facebook({
clientId: process.env.FACEBOOK_CLIENT_ID!,
clientSecret: process.env.FACEBOOK_CLIENT_SECRET!,
callbackUrl: `http://localhost:${process.env.PORT}/facebook/callback`,
},
spotify: {
driver: 'spotify',
}),
spotify: services.spotify({
clientId: process.env.SPOTIFY_CLIENT_ID!,
clientSecret: process.env.SPOTIFY_CLIENT_SECRET!,
callbackUrl: `http://localhost:${process.env.PORT}/spotify/callback`,
},
}),
})

declare module '@adonisjs/ally/types' {
interface SocialProviders extends InferSocialProviders<typeof allyConfig> {}
}

export default allyConfig
10 changes: 4 additions & 6 deletions index.ts
Original file line number Diff line number Diff line change
@@ -7,16 +7,14 @@
* file that was distributed with this source code.
*/

import './src/bindings/types.js'

export { HttpClient as ApiRequest } from '@poppinss/oauth-client'

export * as errors from './src/errors.js'
export { configure } from './configure.js'
export { stubsRoot } from './stubs/main.js'
export { AllyManager } from './src/ally_manager.js'
export { defineConfig } from './src/define_config.js'
export { defineConfig, services } from './src/define_config.js'

export { RedirectRequest } from './src/redirect_request.js'
export { Oauth1Driver } from './src/abstract_drivers/oauth1.js'
export { Oauth2Driver } from './src/abstract_drivers/oauth2.js'
export { default as driversList } from './src/drivers_collection.js'
export { stubsRoot } from './stubs/main.js'
export { configure } from './configure.js'
91 changes: 53 additions & 38 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
{
"name": "@adonisjs/ally",
"version": "5.0.0-3",
"version": "5.0.2",
"description": "Social authentication provider for AdonisJS",
"type": "module",
"main": "build/index.js",
"files": [
"build/src",
"build/stubs",
"build/providers",
"build/index.d.ts",
"build/index.js",
"build/configure.d.ts",
"build/configure.js"
"build",
"!build/bin",
"!build/examples",
"!build/tests"
],
"exports": {
".": "./build/index.js",
"./types": "./build/src/types.js",
"./drivers/*": "./build/src/drivers/*.js",
"./ally_provider": "./build/providers/ally_provider.js"
},
"engines": {
@@ -27,9 +25,11 @@
"clean": "del-cli build",
"typecheck": "tsc --noEmit",
"start": "node --loader=ts-node/esm examples/app.ts",
"copy:templates": "copyfiles \"stubs/**/*.stub\" build",
"compile": "npm run lint && npm run clean && tsc",
"build": "npm run compile && npm run copy:templates",
"copy:templates": "copyfiles --up=1 \"stubs/**/*.stub\" build",
"precompile": "npm run lint && npm run clean",
"compile": "tsup-node && tsc --emitDeclarationOnly --declaration",
"postcompile": "npm run copy:templates",
"build": "npm run compile",
"prepublishOnly": "npm run build",
"lint": "eslint . --ext=.ts",
"format": "prettier --write .",
@@ -47,38 +47,39 @@
"author": "adonisjs,virk",
"license": "MIT",
"devDependencies": {
"@adonisjs/assembler": "^6.1.3-18",
"@adonisjs/core": "^6.1.5-19",
"@adonisjs/eslint-config": "^1.1.8",
"@adonisjs/prettier-config": "^1.1.8",
"@adonisjs/tsconfig": "^1.1.8",
"@commitlint/cli": "^17.7.1",
"@commitlint/config-conventional": "^17.7.0",
"@japa/assert": "^2.0.0-1",
"@japa/expect-type": "^2.0.0-0",
"@japa/file-system": "^2.0.0-1",
"@japa/runner": "^3.0.0-6",
"@swc/core": "^1.3.78",
"@types/node": "^20.5.1",
"c8": "^8.0.1",
"@adonisjs/assembler": "^7.1.0",
"@adonisjs/core": "^6.2.1",
"@adonisjs/eslint-config": "^1.2.1",
"@adonisjs/prettier-config": "^1.2.1",
"@adonisjs/tsconfig": "^1.2.1",
"@commitlint/cli": "^18.5.0",
"@commitlint/config-conventional": "^18.5.0",
"@japa/assert": "^2.1.0",
"@japa/expect-type": "^2.0.1",
"@japa/file-system": "^2.2.0",
"@japa/runner": "^3.1.1",
"@swc/core": "^1.3.105",
"@types/node": "^20.11.5",
"c8": "^9.1.0",
"copyfiles": "^2.4.1",
"del-cli": "^5.0.0",
"dotenv": "^16.3.1",
"eslint": "^8.47.0",
"del-cli": "^5.1.0",
"dotenv": "^16.3.2",
"eslint": "^8.56.0",
"github-label-sync": "^2.3.1",
"husky": "^8.0.3",
"nock": "^13.3.3",
"np": "^8.0.4",
"prettier": "^3.0.2",
"ts-node": "^10.9.1",
"typescript": "^5.1.6"
"nock": "^13.5.0",
"np": "^9.2.0",
"prettier": "^3.2.4",
"ts-node": "^10.9.2",
"tsup": "^8.0.1",
"typescript": "^5.3.3"
},
"dependencies": {
"@poppinss/oauth-client": "^5.1.0-3",
"@poppinss/utils": "^6.5.0-3"
"@poppinss/oauth-client": "^5.1.2",
"@poppinss/utils": "^6.7.1"
},
"peerDependencies": {
"@adonisjs/core": "^6.1.5-19"
"@adonisjs/core": "^6.2.0"
},
"repository": {
"type": "git",
@@ -90,11 +91,11 @@
"homepage": "https://github.com/adonisjs/adonis-ally#readme",
"publishConfig": {
"access": "public",
"tag": "next"
"tag": "latest"
},
"np": {
"message": "chore(release): %s",
"tag": "next",
"tag": "latest",
"branch": "main",
"anyBranch": false
},
@@ -118,5 +119,19 @@
"src/abstract_drivers/**",
"stubs/**"
]
},
"tsup": {
"entry": [
"./index.ts",
"./src/types.ts",
"./src/drivers/*.ts",
"./providers/ally_provider.ts"
],
"outDir": "./build",
"clean": true,
"format": "esm",
"dts": false,
"sourcemap": true,
"target": "esnext"
}
}
Loading