auth 1.2.1 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/commands/add.js CHANGED
@@ -38,19 +38,17 @@ const choices = Object.entries(providers)
38
38
  /** @param {string | undefined} providerId */
39
39
  export async function action(providerId) {
40
40
  try {
41
- const pid =
42
- providerId ??
43
- (await select({
44
- message: "What provider do you want to set up?",
45
- choices: choices,
46
- }))
47
-
48
- const provider = providers[pid]
41
+ providerId ??= await select({
42
+ message: "What provider do you want to set up?",
43
+ choices: choices,
44
+ })
45
+
46
+ const provider = providers[providerId]
49
47
  if (!provider?.setupUrl) {
50
48
  console.error(
51
49
  y.red(
52
50
  `Missing instructions for ${
53
- provider?.name ?? pid
51
+ provider?.name ?? providerId
54
52
  }.\nInstructions are available for: ${y.bold(
55
53
  choices.map((choice) => choice.name).join(", ")
56
54
  )}`
@@ -135,7 +133,7 @@ ${y.bold("Callback URL (copied to clipboard)")}: ${url}`
135
133
 
136
134
  console.log(y.dim("Updating environment variable file..."))
137
135
 
138
- const varPrefix = `AUTH_${pid.toUpperCase()}`
136
+ const varPrefix = `AUTH_${providerId.toUpperCase()}`
139
137
  await updateEnvFile({
140
138
  [`${varPrefix}_ID`]: clientId,
141
139
  [`${varPrefix}_SECRET`]: clientSecret,
@@ -59,7 +59,9 @@ async function signJWT(sub, iss, kid, privateKeyPath, exp) {
59
59
  toBase64Url(encoder.encode(JSON.stringify(payload))),
60
60
  ]
61
61
 
62
- const privateKey = fs.readFileSync(path.resolve(privateKeyPath), "utf8")
62
+ const privateKey = fs
63
+ .readFileSync(path.resolve(privateKeyPath), "utf8")
64
+ .replace(/-----BEGIN PRIVATE KEY-----|\n|-----END PRIVATE KEY-----/g, "")
63
65
 
64
66
  const signature = await sign(parts.join("."), privateKey)
65
67
 
package/lib/meta.js CHANGED
@@ -158,7 +158,25 @@ export const providers = {
158
158
  todoist: { name: "Todoist", setupUrl: undefined },
159
159
  trakt: { name: "Trakt", setupUrl: undefined },
160
160
  twitch: { name: "Twitch", setupUrl: undefined },
161
- twitter: { name: "Twitter", setupUrl: undefined },
161
+ twitter: {
162
+ name: "Twitter",
163
+ setupUrl: "https://developer.x.com/en/portal/dashboard",
164
+ instructions: `\
165
+ 1. Create a project
166
+ 2. Set the *Project name* (can be anything)
167
+ 3. Choose a use case, then click Next
168
+ 4. Give it a description, then click Next
169
+ 5. An app will be created for you
170
+ 6. Set the app name
171
+ 7. Click on *App Settings*
172
+ 8. Click *Set up* under *User authentication settings*
173
+ 9. Select *Web App, Automated App or Bot* at "Type of app"
174
+ 10. Add the callback URI (on your clipboard) to *Callback URLs*
175
+ 11. Fill out the other required fields (your website)
176
+ 12. Copy and paste the *Client ID*
177
+ 13. Copy and paste the *Client Secret*
178
+ 14. Click *Done*`,
179
+ },
162
180
  "united-effects": { name: "United Effects", setupUrl: undefined },
163
181
  vk: { name: "Vk", setupUrl: undefined },
164
182
  webex: { name: "Webex", setupUrl: undefined },
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "auth",
3
- "version": "1.2.1",
3
+ "version": "1.2.3",
4
4
  "homepage": "https://cli.authjs.dev",
5
5
  "repository": {
6
6
  "type": "git",
7
- "url": "git+https://github.com/nextauthjs/auth-cli.git"
7
+ "url": "git+https://github.com/nextauthjs/cli.git"
8
8
  },
9
9
  "description": "The CLI tool by Auth.js to supercharge your authentication workflows.",
10
10
  "author": "Balázs Orbán <info@balazsorban.com>",