Cache credentials #25
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR enables caching of credentials required for the publish command.
Behavior
The behavior is different depending on how the command is executed.
ember-micro:publish addonName -u username -p passwordUsername and password are provided. A new token will be created and stored in the file system.
ember-micro:publish adddonNameUsername and password are not provided. The application will attempt to load a stored token from the file system.
If a token is found, it will be used to authorize.
If a token is not found, the user will be prompted for a username and password. Once those are provided, a new token will be created and stored in the file system.
Issues
The created token is stored on the github account. In most cases, there will only ever be a few tokens created by ember-micro-addon, but in some cases, it may be considered a bit spammy.
Is this approach acceptable, or should I look into somehow making it less spammy? We can't really retrieve an existing token. We can retrieve the data for it, but the token itself is not returned, only the hash for it, and the last 8 characters.
The only way I think this is possible is to register the app and use a secret/public key system, but even then, I'm not sure if it's possible to avoid creating multiple tokens.
An alternative is to not use a token at all and store username/password credentials locally, but that sounds very unsafe.