-
Notifications
You must be signed in to change notification settings - Fork 530
Authentication v2 #100
Authentication v2 #100
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about making this the default export?
|
I deleted my two other comments since they're not necessary, but it would be cool if we made the |
cli/script/command-executor.ts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With existing helper methods, you can simplify lines 518-523 to:
var decoded: string = tryBase64Decode(accessToken);
var connectionInfo: ILegacyLoginConnectionInfo|ILoginConnectionInfo = tryJSON(decoded);
cli/script/command-executor.ts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines 878 and 883 can be deduplicated by moving after the if...else block. Might also be able to deduplicate the JSON.stringify(...) call like so:
var connectionInfo: IStandardLoginConnectionInfo | IAccessKeyLoginConnectionInfo = tryJSON(json);
if (connectionInfo) {
connectionInfo.serverUrl = serverUrl;
} else {
connectionInfo = { serverUrl: serverUrl, accessKey: accessToken };
}
json = JSON.stringify(connectionInfo);
fs.writeFileSync(configFilePath, json, { encoding: "utf8" });
|
Looks good. |
1 similar comment
|
Looks good. |
|
The default export thing is actually a surprisingly hard change to make considering that we need to handle exporting both TypeScript interfaces and a default JavaScript object, manage .d.ts generation, and handle inter-op between CommonJS and ES6. I've talked to Jonathan about this and I'll be doing this as part of a later PR to prepare the SDK for external usage. |
Cookieless header-based authentication
(Merging into 'breaking' branch)
A faster, more secure, and simpler login process using the access-key as a bearer token with every request instead of exchanging it for a session identifier cookie. Also, a significant amount of simplifying refactoring work, especially to the SDK for future external consumption.
Additional SDK changes:
Note that the external OAuth provider login/registration process is not currently covered in the SDK - the CLI has always independently launched an external browser session. I may do future investigative work to see if there are simplifications we can make here for external consumption.