stuartcryan / lastpass-alfred-workflow

Simple Lastpass Workflow for Alfred
GNU General Public License v2.0
224 stars 69 forks source link

It appears you are not logged in to Lastpass. #54

Open diegosantamarta opened 5 years ago

diegosantamarta commented 5 years ago

I put my login credentials but when I try to search hace this error:

captura de pantalla 2019-02-21 a las 12 33 26

The debug output on Alfred with All information is:

[2019-02-21 12:33:23][input.scriptfilter] Queuing argument 'zeplin'
[2019-02-21 12:33:24][input.scriptfilter] Script with argument '(null)' finished
[2019-02-21 12:33:24][ERROR: input.scriptfilter] Code 1: <?xml version="1.0"?>
<items>
<item uid="error-login"><arg>'error-login', ''</arg><title>It appears you are not logged in to LastPass.</title><subtitle>Please login using the 'lplogin' command or press 'ctrl' + enter to login now.</subtitle><icon>icon.png</icon></item>
</items>

Thanks in advance Diego

parceritaz commented 5 years ago

I'm getting the same error, tried multiples times and no dice. I'm on version 4 of Alfred so maybe that's why...?

stuartcryan commented 5 years ago

Howdy, out of curiosity, I want to confirm, you have put your login credentials with 'lpsetemail', have you also then run 'lplogin'?

If so, when you open up a terminal session in MacOS and type 'lpass status' does it say you are logged in or logged out? Cheers, Stuart

probablykasper commented 5 years ago

Debug output from running lplogin:

[2:25:08.729] LastPass CLI[Keyword] Processing complete
[2:25:08.729] LastPass CLI[Keyword] Passing output '' to Run Script
[2:25:08.861] ERROR: LastPass CLI[Run Script] 2845:2846: syntax error: Expected end of line but found ā€œ"ā€. (-2741)
juandaco commented 5 years ago

I was having this same issue. You just need to replace in the osascript block that comes out of lplogin, Alfred 3 for Alfred 4. The window prompting you for your master password appears after that and everything is working as it should.

probablykasper commented 5 years ago

@juandaco Tried this, and it seems to have fixed one issue, but lplogin still gives an error:

[11:21:37.386] LastPass CLI[Keyword] Processing complete
[11:21:37.387] LastPass CLI[Keyword] Passing output '' to Run Script
[11:21:37.616] ERROR: LastPass CLI[Run Script] 2637:2649: execution error: The variable lpass_binary is not defined. (-2753)
probablykasper commented 5 years ago

@juandaco Nevermind, I installed the workflow wrong. Works like a charm now

stacksjb commented 5 years ago

Thanks, I had the same issue, working now.

squatto commented 5 years ago

For those that are coming to this issue looking for a solution, I wanted to put it as the last comment to make it easier to find. Once #56 is merged this will no longer be an issue, but until that happens, you can easily fix it yourself by doing the following:

  1. Open Alfred Preferences and go to "Workflows" in the left nav menu
  2. Select the "LastPass CLI" workflow
  3. Double click the top workflow step that says /usr/bin/osascript to open the script editor
  4. Go to the end of the file and change the second to last line from this:

    tell application "Alfred 3" to search "lp "

    To this:

    tell application id "com.runningwithcrayons.Alfred" to search "lp "
  5. Press the "Save" button
  6. Trigger the lplogin workflow again (make sure that you've set your account email with lpsetemail your@email.com first!)

Everything should work as expected from now on šŸ‘

Thanks goes out to @juandaco and @sublime392 for pointing me in the right direction with the fix!

wcj3 commented 4 years ago

@squatto Not sure what OS you're using but the steps above didn't work for me on macOS catalina

diegosantamarta commented 4 years ago

@squatto doesn't work for me:

Starting debug for 'LastPass CLI'

[2019-11-12 13:01:43][ERROR: action.script] 2812:2858: syntax error: No puede obtenerse application id "com.runningwithcrayons.Alfred". (-1728)
squatto commented 4 years ago

@wcj3 @diegosantamarta I'm on Catalina now but I implemented that fix prior to upgrading. It's still working on Catalina - I'll check my workflow and see if anything has changed.

squatto commented 4 years ago

@wcj3 @diegosantamarta

I enabled debug on the workflow and ran lp test and had this output:

[09:11:06.968] LastPass CLI[Script Filter] Queuing argument 'test'
[09:11:07.140] LastPass CLI[Script Filter] Script with argv '(null)' finished
[09:11:07.145] ERROR: LastPass CLI[Script Filter] Code 1: <?xml version="1.0"?>
<items>
<item uid="error-login"><arg>scriptlocationnotset</arg><title>It appears you are not logged in to LastPass.</title><subtitle>Please login using the 'lplogin' command or press 'ctrl' + enter to login now.</subtitle><icon>icon.png</icon></item>
</items>

I pressed ctrl+enter to trigger lplogin and had this debug output:

[09:11:22.413] LastPass CLI[Script Filter] Processing complete
[09:11:22.415] LastPass CLI[Script Filter] Passing output 'scriptlocationnotset' to Run Script

The lplogin process ran, asked me for my master password, and I am now logged in and able to search my vault. The second to last line of the osascript workflow step (what I referred to in my initial comment) is the same as it was in that same comment:

tell application id "com.runningwithcrayons.Alfred" to search "lp "

I verified the bundle ID of my Alfred application, just to be sure:

$ mdls -name kMDItemCFBundleIdentifier -r "/Applications/Alfred 4.app"
com.runningwithcrayons.Alfred

Try running this command to make sure that your Alfred bundle ID matches - if not, change the updated osascript command to match your bundle ID.


If you want to manually trigger the osascript line that my comment instructed you to change, you can do so from your terminal:

osascript -e 'tell application id "com.runningwithcrayons.Alfred" to search "lp "'

It should open up the Alfred workflow prompt with "lp " entered:

image


I am running the latest version of the workflow (version 1.7.4), macOS Catalina 10.15.1, on a 2018 MacBook Pro.


I put my entire /usr/bin/osascript workflow step's code into this gist if you want to review it and compare it against your version.

diegosantamarta commented 4 years ago

Hi @squatto I tell you my steps: I enabled debug on the workflow and ran lp test and had this output:

[13:39:16.222] LastPass CLI[Script Filter] Queuing argument 'test'
[13:39:16.485] LastPass CLI[Script Filter] Script with argv '(null)' finished
[13:39:16.490] ERROR: LastPass CLI[Script Filter] Code 1: <?xml version="1.0"?>
<items>
<item uid="error-login"><arg>'error-login', ''</arg><title>It appears you are not logged in to LastPass.</title><subtitle>Please login using the 'lplogin' command or press 'ctrl' + enter to login now.</subtitle><icon>icon.png</icon></item>
</items>

I pressed ctrl+enter to trigger lplogin and had this debug output:

[13:39:50.956] LastPass CLI[Script Filter] Processing complete
[13:39:50.957] LastPass CLI[Script Filter] Passing output ''error-login', ''' to Run Script

The lplogin process ran, asked me for my master password, and I am not logged in.

image

Not workin...

I'm with Alfred 4 workflow 1.7.4 macOS High Sierra on a 10.13.6 iMac

carceneaux commented 4 years ago

@diegosantamarta Please make sure read @squatto's comment in full as he provides all the information you need to resolve this issue.

@wcj3 Like @squatto, I'm also running the latest version of the workflow (version 1.7.4), macOS Catalina 10.15.1, but on a 2019 MacBook Pro.

wcj3 commented 4 years ago

@carceneaux @squatto Running the debug helped, was not aware of that. Turns out I just needed to follow the installation steps again in addition to the fix mentioned here

squatto commented 4 years ago

@wcj3 Iā€™m glad that you were able to get it resolved!

@diegosantamarta are you able to log in by running the lplogin workflow command? If not, I would recommend deleting the workflow completely, installing it again, and making the change to the osascript step.

glassdimly commented 4 years ago

So I just got a new mac, and lastpass cli wasn't working! Dammit! So I started googling, and then I found that I had submitted a PR. Hah. But there was an additional step, which I had to read through this thread to figure out again.

Here are my instructions to make this work for you or for future me:

Check out my forked repository, then the branch with the fix on it.

git clone https://github.com/glassdimly/lastpass-alfred-workflow.git
git checkout fix/you-are-not-logged-in

Install by double-clicking the .workflow file.

Then make a modification to the lplogin osascript image

At the end of this file, replace Alfred 3 with Alfred 4, so it looks like this: image

Save, and now it will work.

tonykaram1993 commented 4 years ago

@glassdimly Your post helped me fix the issue. In my case all I had to was change "Aflred 3" to "Alfred 4" and it all worked, did not need to anything else. I had tried to use @squatto 's fix here but it didn't work, yours did.

Cheers!

nathankoerschner commented 4 years ago

@glassdimly Same success, #56 didn't work buy yours did! Thanks.

nathankoerschner commented 4 years ago

Just got a new Mac, and the fix isnt working for me anymore. Whats new in this case is that when typing out lp <query> the option to search vault for does not persist, and just gives my default Alfred search options. Any ideas @glassdimly ?

ysjiang4869 commented 4 years ago

For me, there is two problem

  1. This is my new mac, so I need to verify device through email, but I forget the email notification
  2. I open the 2FA, so need to verify it, if your debug console show something like ctrl+c to enter passcode you better to open 2FA and enable or use cli to login by yourself.
Latent-code commented 2 years ago

@juandaco Nevermind, I installed the workflow wrong. Works like a charm now

What did you do to fix that issue? Im still getting the following error: ERROR: LastPass CLI[Run Script] 2637:2649: execution error: The variable lpass_binary is not defined. (-2753)

I have changed from Alfred 3 to Alfred 4.

mikeohara commented 2 years ago

@Latent-code The fix I found involved editing the osascript and adding

else if exists POSIX file "/opt/homebrew/bin/lpass" then set lpass_binary to "/opt/homebrew/bin/lpass"

in the tell application Finder block near the bottom of the file. Seems in newer versions of brew installs to a different location.

jzadra commented 2 years ago

This fixed it for me! Alfred 4.6.5

@Latent-code The fix I found involved editing the osascript and adding

else if exists POSIX file "/opt/homebrew/bin/lpass" then set lpass_binary to "/opt/homebrew/bin/lpass"

in the tell application Finder block near the bottom of the file. Seems in newer versions of brew installs to a different location.