create-egregore 0.12.6 → 0.13.0
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/lib/auth.js +5 -2
- package/lib/local.js +2 -2
- package/package.json +1 -1
package/lib/auth.js
CHANGED
|
@@ -73,12 +73,15 @@ function copyToClipboard(text) {
|
|
|
73
73
|
/**
|
|
74
74
|
* Run GitHub Device Flow.
|
|
75
75
|
* Returns the access token string, or throws on failure.
|
|
76
|
+
* @param {object} ui - UI module for output
|
|
77
|
+
* @param {object} [opts] - Options
|
|
78
|
+
* @param {string} [opts.scope] - Override OAuth scope (e.g. "repo" for join flow)
|
|
76
79
|
*/
|
|
77
|
-
async function deviceFlow(ui) {
|
|
80
|
+
async function deviceFlow(ui, opts = {}) {
|
|
78
81
|
// 1. Request device code
|
|
79
82
|
const codeResp = await post("https://github.com/login/device/code", {
|
|
80
83
|
client_id: CLIENT_ID,
|
|
81
|
-
scope: SCOPE,
|
|
84
|
+
scope: opts.scope ?? SCOPE,
|
|
82
85
|
});
|
|
83
86
|
|
|
84
87
|
if (!codeResp.device_code) {
|
package/lib/local.js
CHANGED
|
@@ -568,11 +568,11 @@ async function localJoinFlow(orgArg, ui) {
|
|
|
568
568
|
explicitRepo = null;
|
|
569
569
|
}
|
|
570
570
|
|
|
571
|
-
// 1. GitHub auth
|
|
571
|
+
// 1. GitHub auth — repo scope needed to access repos on other accounts
|
|
572
572
|
ui.info(`Joining ${ui.bold(orgLogin)}. First, sign in with GitHub.\n`);
|
|
573
573
|
let githubToken;
|
|
574
574
|
try {
|
|
575
|
-
githubToken = await deviceFlow(ui);
|
|
575
|
+
githubToken = await deviceFlow(ui, { scope: "repo" });
|
|
576
576
|
ui.success("Authenticated with GitHub");
|
|
577
577
|
} catch (err) {
|
|
578
578
|
ui.error(`GitHub auth failed: ${err.message}`);
|