Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add possibility to store login by project #42

Open
nirazul opened this issue Feb 13, 2018 · 10 comments
Open

Add possibility to store login by project #42

nirazul opened this issue Feb 13, 2018 · 10 comments

Comments

@nirazul
Copy link
Contributor

nirazul commented Feb 13, 2018

Feature request
I have a company project using clasp and a private one. When I'm switching projects, I need to change my clasp login inbetween.
If possible, it'd be nice to store a separate login projectwise instead of a global clasp login.

@grant
Copy link
Contributor

grant commented Mar 6, 2018

I wrote a proposal of how we could store multiple Google account login creds here: #12 (comment)

Basically, you can set settingIds ([default/global]/"work"/"personal"/"testGoogleAccount") that you can tie to projects.
i.e. multilogin support.

@grant grant added the docs label Jun 1, 2018
@grant grant added this to the Nice To Have milestone Oct 29, 2018
@grant
Copy link
Contributor

grant commented Nov 27, 2018

Workaround 1:

You can clasp login --creds creds.json with your own credentials from different profiles if you're interested in working with multiple projects right now. This saves the credentials per directory, but it takes some setup.

Workaround 2:

You could also do something like this:

clasp login # work
mv ~/.clasprc.json ~/.clasprc-work.json
clasp login # personal
mv ~/.clasprc.json ~/.clasprc-personal.json

Switch with:

cp ~/.clasprc-personal.json ~/.clasprc.json

@grant
Copy link
Contributor

grant commented Dec 11, 2018

Solution

New flag:

clasp login --local

Saves .clasprc.json locally, but would use global clasp credentials.

clasp login # global for all projects
clasp login --creds creds.json # your own creds
clasp login --local # local project. Useful for multiple Google accounts.
clasp login --creds creds.json --local # own creds, local

See https://github.com/google/clasp/pull/447/files#r240480830

@nirazul
Copy link
Contributor Author

nirazul commented Dec 23, 2018

Sounds like a clean solution. Thanks, I'm looking forward to it!

@NoSubstitute
Copy link

Is there hope of any progress soon?

@kospl
Copy link
Contributor

kospl commented Sep 26, 2020

clasp login --local

unfortunately, this workaround doesn't work anymore as of 2.3.0 version:

error: unknown option '--local'

@PopGoesTheWza
Copy link
Collaborator

Try replacing @google/clasp 2.3.0 with forked-clasp which is more advanced. : https://github.com/PopGoesTheWza/clasp/blob/forked/docs/config-files.md

npm uninstall -g @google/clasp
npm install -g forked-clasp

@PopGoesTheWza PopGoesTheWza added the forked-clasp fixed in forked-clasp label Mar 19, 2021
@PopGoesTheWza PopGoesTheWza removed the forked-clasp fixed in forked-clasp label May 12, 2021
@PopGoesTheWza
Copy link
Collaborator

@imthenachoman
Copy link

@PopGoesTheWza Should forked-clasp have --local? I am on 2.11.0 and --local is an unknown option.

@PopGoesTheWza
Copy link
Collaborator

@imthenachoman you can try @google/[email protected] (not 3.2.2 which is a temporary rollback) or next release. Currently local/per project setting can be achieved using either environment variables or command line option as described here https://github.com/google/clasp/blob/master/docs/config-files.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants