blacs30 / bitwarden-alfred-workflow

Simple Bitwarden Workflow for Alfred
MIT License
448 stars 31 forks source link

Logged in but locked, but unable to unlock because not logged in #23

Closed JasperV closed 4 years ago

JasperV commented 4 years ago

Hi,

Awesome that you updated to make it work with all bw installs!

However I am having this weird issue, even after complete removal and reinstallation. Where I cannot unlock, but I am logged in.

This is some of the logs;

[09:01:00.936] Bitwarden v2[Script Filter] Processing complete
[09:01:00.939] Bitwarden v2[Script Filter] Passing output '-background' to Conditional
[09:01:00.940] Bitwarden v2[Conditional] Processing complete
[09:01:00.940] Bitwarden v2[Conditional] Passing output '-background' to Arg and Vars
[09:01:00.941] Bitwarden v2[Arg and Vars] Processing complete
[09:01:00.942] Bitwarden v2[Arg and Vars] Passing output 'Syncing Bitwarden secrets cache…' to Post Notification
[09:01:00.964] Bitwarden v2[Conditional] Passing output '-background' to Run Script
[09:01:02.469] Bitwarden v2[Script Filter] Queuing argument 'unlock'
[09:01:02.497] STDERR: Bitwarden v2[Run Script] 🍺
09:01:00 workflow.go:328: -------- Bitwarden v2/2.0.0 (AwGo/0.26.2) --------
09:01:00 main.go:160: &main.options{Search:false, Config:false, SetConfigs:false, Auth:false, Sfa:false, Lock:false, Icons:false, Folder:false, Unlock:false, Login:false, Logout:false, Sync:true, Open:false, GetItem:false, Force:true, Totp:false, Last:false, Cache:false, Background:true, Id:"", Query:"", Previous:"", Attachment:"", Output:""}
09:01:00 main.go:162: args=[]string{"-sync", "-force", "-background"} => []string{}
09:01:00 main.go:163: Workflow configs => [email: test@example.com 2FA enabled: true 2FA Mode: Authenticator-app Server: https://bitwarden.com]
09:01:00 bitwarden.go:26: Clearing items cache.
09:01:02 utils.go:22: [ERROR] ==> [Vault is locked.]

09:01:02 utils.go:22: [ERROR] ==> Exit code 1. Not logged in. Need to login first. Err: Vault is locked.

09:01:02 utils.go:22: [ERROR] ==> Not logged in. Need to login first. Error:
Vault is locked.

09:01:02 utils.go:87: Search called with argument  .bwauth unlock
09:01:02 workflow.go:405: ------------------ 1.514220232s ------------------
[09:01:02.499] Bitwarden v2[Run Script] Processing complete
[09:01:02.499] Bitwarden v2[Run Script] Passing output 'Not unlocked. Need to unlock first.
' to Post Notification
[09:01:02.500] Bitwarden v2[Script Filter] Script with argv 'unlock' finished
[09:01:02.501] STDERR: Bitwarden v2[Script Filter] 🍺
09:01:02 workflow.go:328: -------- Bitwarden v2/2.0.0 (AwGo/0.26.2) --------
09:01:02 main.go:160: &main.options{Search:false, Config:false, SetConfigs:false, Auth:true, Sfa:false, Lock:false, Icons:false, Folder:false, Unlock:false, Login:false, Logout:false, Sync:false, Open:false, GetItem:false, Force:false, Totp:false, Last:false, Cache:false, Background:false, Id:"", Query:"unlock", Previous:"", Attachment:"", Output:""}
09:01:02 main.go:162: args=[]string{"-auth", "--", "unlock"} => []string{"unlock"}
09:01:02 main.go:163: Workflow configs => [email: email@example.com 2FA enabled: true 2FA Mode: Authenticator-app Server: https://bitwarden.com]
09:01:02 cli.go:293: filtering auth config "unlock" ...
09:01:02 feedback.go:482: Sent 1 result(s) to Alfred
09:01:02 workflow.go:405: ------------------- 5.364639ms -------------------
[09:01:02.503] Bitwarden v2[Script Filter] {
  "variables": {
    "AW_SESSION_ID": "XXXXX"
  },
  "items": [
    {
      "title": "Unlock",
      "subtitle": "Unlock Bitwarden",
      "uid": "unlock",
      "valid": true,
      "icon": {
        "path": "icons/on.png"
      },
      "variables": {
        "action": "-unlock"
      }
    }
  ]
}
[09:01:05.057] Bitwarden v2[Script Filter] Processing complete
[09:01:05.061] Bitwarden v2[Script Filter] Passing output '' to Conditional
[09:01:05.062] Bitwarden v2[Conditional] Processing complete
[09:01:05.063] Bitwarden v2[Conditional] Passing output '' to Arg and Vars
[09:01:05.064] Bitwarden v2[Arg and Vars] Processing complete
[09:01:05.065] Bitwarden v2[Arg and Vars] Passing output '' to Post Notification
[09:01:05.066] Bitwarden v2[Conditional] Passing output '' to Run Script
[09:01:06.438] ERROR: Bitwarden v2[Run Script] 🍺
09:01:05 workflow.go:328: -------- Bitwarden v2/2.0.0 (AwGo/0.26.2) --------
09:01:05 main.go:160: &main.options{Search:false, Config:false, SetConfigs:false, Auth:false, Sfa:false, Lock:false, Icons:false, Folder:false, Unlock:true, Login:false, Logout:false, Sync:false, Open:false, GetItem:false, Force:false, Totp:false, Last:false, Cache:false, Background:false, Id:"", Query:"", Previous:"", Attachment:"", Output:""}
09:01:05 main.go:162: args=[]string{"-unlock"} => []string{}
09:01:05 main.go:163: Workflow configs => [email: email@example.com 2FA enabled: true 2FA Mode: Authenticator-app Server: https://bitwarden.com]
09:01:06 utils.go:22: [ERROR] ==> [Vault is locked.]

09:01:06 utils.go:22: [ERROR] ==> Exit code 1. Not logged in. Need to login first. Err: Vault is locked.

09:01:06 utils.go:22: [ERROR] ==> Not logged in. Need to login first. Error:
Vault is locked.

09:01:06 workflow.go:376: [ERROR] Unexpected error. Exit code -1.

So this says not logged in. But when using the .bwauth command, it tells me I am logged in. Not sure what to make of this. Is there some other cache I can clear or something? Tried all the available options in the workflow. And I removed and reinstalled the workflow several times completely. My BW cli is installed via npm, but the path is correctly set in the workflow.

blacs30 commented 4 years ago

@JasperV can you please update to version 2.0.1 unfortunately, because of bundle id change, you need to delete the workflow and download the file manually.

I expect the error will still occur however I added more logging in case of an unexpected exit code - which is here the case with -1. Would be great to see the logs again after the update.

I have installed nvm and node and installed then npm -g i @bitwarden/cli, I had to add to the path env var this bit /Users/myuser/.nvm/versions/node/v14.7.0/bin. the workflow worked fine.

Is the bw cli working normal in the terminal?

JasperV commented 4 years ago

Hi @blacs30,

Yes, the bw cli is working normal. I also have the GUI version installed. Both are working fine. I am logged in to both of these.

Here are some more logs after reinstalling v2.1.

I did notice that even after removing and reinstalling it immediately knew my email and status and tried to sync...

[08:22:46.092] Logging Started...
[08:22:53.611] Bitwarden v2[Script Filter] Queuing argument '(null)'
[08:22:53.771] Bitwarden v2[Script Filter] Queuing argument '(null)'
[08:22:53.785] Bitwarden v2[Script Filter] Script with argv '(null)' finished
[08:22:53.790] STDERR: Bitwarden v2[Script Filter] 🍺
08:22:53 workflow.go:328: -------- Bitwarden v2/2.0.1 (AwGo/0.26.2) --------
08:22:53 main.go:160: &main.options{Search:false, Config:false, SetConfigs:false, Auth:false, Sfa:false, Lock:false, Icons:false, Folder:false, Unlock:false, Login:false, Logout:false, Sync:false, Open:false, GetItem:false, Force:false, Totp:false, Last:false, Cache:false, Background:false, Id:"", Query:"", Previous:"", Attachment:"", Output:""}
08:22:53 main.go:162: args=[]string{} => []string{}
08:22:53 main.go:163: Workflow configs => [email: test@example.com 2FA enabled: true 2FA Mode: Authenticator-app Server: https://bitwarden.com]
08:22:53 icons.go:79: progress: current=0, next=1
08:22:53 feedback.go:482: Sent 1 result(s) to Alfred
08:22:53 cli.go:514: Sync job already running.
08:22:53 icons.go:79: progress: current=0, next=1
08:22:53 feedback.go:472: Feedback already sent. Ignoring.
08:22:53 workflow.go:405: ------------------- 2.06158ms --------------------
[08:22:53.816] Bitwarden v2[Script Filter] {
  "variables": {
    "AW_SESSION_ID": "XXXXX",
    "RELOAD_PROGRESS": "1"
  },
  "rerun": 0.3,
  "items": [
    {
      "title": "Syncing Bitwarden secrets…",
      "valid": false,
      "icon": {
        "path": "icons/loading.png"
      }
    }
  ]
}
[08:22:54.091] Bitwarden v2[Script Filter] Queuing argument '(null)'
[08:22:54.163] Bitwarden v2[Script Filter] Script with argv '(null)' finished
[08:22:54.175] STDERR: Bitwarden v2[Script Filter] 🍺
08:22:54 workflow.go:328: -------- Bitwarden v2/2.0.1 (AwGo/0.26.2) --------
08:22:54 main.go:160: &main.options{Search:false, Config:false, SetConfigs:false, Auth:false, Sfa:false, Lock:false, Icons:false, Folder:false, Unlock:false, Login:false, Logout:false, Sync:false, Open:false, GetItem:false, Force:false, Totp:false, Last:false, Cache:false, Background:false, Id:"", Query:"", Previous:"", Attachment:"", Output:""}
08:22:54 main.go:162: args=[]string{} => []string{}
08:22:54 main.go:163: Workflow configs => [email: test@example.com 2FA enabled: true 2FA Mode: Authenticator-app Server: https://bitwarden.com]
08:22:54 icons.go:79: progress: current=1, next=2
08:22:54 feedback.go:482: Sent 1 result(s) to Alfred
08:22:54 cli.go:514: Sync job already running.
08:22:54 icons.go:79: progress: current=1, next=2
08:22:54 feedback.go:472: Feedback already sent. Ignoring.
08:22:54 workflow.go:405: ------------------- 1.298727ms -------------------
[08:22:54.177] Bitwarden v2[Script Filter] {
  "variables": {
    "AW_SESSION_ID": "XXXXX",
    "RELOAD_PROGRESS": "2"
  },
  "rerun": 0.3,
  "items": [
    {
      "title": "Syncing Bitwarden secrets…",
      "valid": false,
      "icon": {
        "path": "icons/loading-15.png"
      }
    }
  ]
}
[08:22:54.468] Bitwarden v2[Script Filter] Queuing argument '(null)'
[08:22:54.542] Bitwarden v2[Script Filter] Script with argv '(null)' finished
[08:22:54.556] STDERR: Bitwarden v2[Script Filter] 🍺
08:22:54 workflow.go:328: -------- Bitwarden v2/2.0.1 (AwGo/0.26.2) --------
08:22:54 main.go:160: &main.options{Search:false, Config:false, SetConfigs:false, Auth:false, Sfa:false, Lock:false, Icons:false, Folder:false, Unlock:false, Login:false, Logout:false, Sync:false, Open:false, GetItem:false, Force:false, Totp:false, Last:false, Cache:false, Background:false, Id:"", Query:"", Previous:"", Attachment:"", Output:""}
08:22:54 main.go:162: args=[]string{} => []string{}
08:22:54 main.go:163: Workflow configs => [email: test@example.com 2FA enabled: true 2FA Mode: Authenticator-app Server: https://bitwarden.com]
08:22:54 icons.go:79: progress: current=2, next=0
08:22:54 feedback.go:482: Sent 1 result(s) to Alfred
08:22:54 cli.go:514: Sync job already running.
08:22:54 icons.go:79: progress: current=2, next=0
08:22:54 feedback.go:472: Feedback already sent. Ignoring.
08:22:54 workflow.go:405: ------------------- 2.565076ms -------------------
[08:22:54.557] Bitwarden v2[Script Filter] {
  "variables": {
    "AW_SESSION_ID": "XXXXX",
    "RELOAD_PROGRESS": "0"
  },
  "rerun": 0.3,
  "items": [
    {
      "title": "Syncing Bitwarden secrets…",
      "valid": false,
      "icon": {
        "path": "icons/loading-30.png"
      }
    }
  ]
}
[08:22:54.845] Bitwarden v2[Script Filter] Queuing argument '(null)'
[08:22:54.918] Bitwarden v2[Script Filter] Script with argv '(null)' finished
[08:22:54.945] STDERR: Bitwarden v2[Script Filter] 🍺
08:22:54 workflow.go:328: -------- Bitwarden v2/2.0.1 (AwGo/0.26.2) --------
08:22:54 main.go:160: &main.options{Search:false, Config:false, SetConfigs:false, Auth:false, Sfa:false, Lock:false, Icons:false, Folder:false, Unlock:false, Login:false, Logout:false, Sync:false, Open:false, GetItem:false, Force:false, Totp:false, Last:false, Cache:false, Background:false, Id:"", Query:"", Previous:"", Attachment:"", Output:""}
08:22:54 main.go:162: args=[]string{} => []string{}
08:22:54 main.go:163: Workflow configs => [email: test@example.com 2FA enabled: true 2FA Mode: Authenticator-app Server: https://bitwarden.com]
08:22:54 icons.go:79: progress: current=0, next=1
08:22:54 feedback.go:482: Sent 1 result(s) to Alfred
08:22:54 cli.go:514: Sync job already running.
08:22:54 icons.go:79: progress: current=0, next=1
08:22:54 feedback.go:472: Feedback already sent. Ignoring.
08:22:54 workflow.go:405: ------------------- 1.429328ms -------------------
[08:22:54.947] Bitwarden v2[Script Filter] {
  "variables": {
    "AW_SESSION_ID": "XXXXX",
    "RELOAD_PROGRESS": "1"
  },
  "rerun": 0.3,
  "items": [
    {
      "title": "Syncing Bitwarden secrets…",
      "valid": false,
      "icon": {
        "path": "icons/loading.png"
      }
    }
  ]
}
[08:22:55.187] Bitwarden v2[Script Filter] Queuing argument 'unlock'
[08:22:55.267] Bitwarden v2[Script Filter] Script with argv 'unlock' finished
[08:22:55.274] STDERR: Bitwarden v2[Script Filter] 🍺
08:22:55 workflow.go:328: -------- Bitwarden v2/2.0.1 (AwGo/0.26.2) --------
08:22:55 main.go:160: &main.options{Search:false, Config:false, SetConfigs:false, Auth:true, Sfa:false, Lock:false, Icons:false, Folder:false, Unlock:false, Login:false, Logout:false, Sync:false, Open:false, GetItem:false, Force:false, Totp:false, Last:false, Cache:false, Background:false, Id:"", Query:"unlock", Previous:"", Attachment:"", Output:""}
08:22:55 main.go:162: args=[]string{"-auth", "--", "unlock"} => []string{"unlock"}
08:22:55 main.go:163: Workflow configs => [email: test@example.com 2FA enabled: true 2FA Mode: Authenticator-app Server: https://bitwarden.com]
08:22:55 cli.go:297: filtering auth config "unlock" ...
08:22:55 feedback.go:482: Sent 1 result(s) to Alfred
08:22:55 workflow.go:405: ------------------- 4.474273ms -------------------
[08:22:55.276] Bitwarden v2[Script Filter] {
  "variables": {
    "AW_SESSION_ID": "XXXXX"
  },
  "items": [
    {
      "title": "Unlock",
      "subtitle": "Unlock Bitwarden",
      "uid": "unlock",
      "valid": true,
      "icon": {
        "path": "icons/on.png"
      },
      "variables": {
        "action": "-unlock"
      }
    }
  ]
}
[08:22:58.746] Bitwarden v2[Script Filter] Processing complete
[08:22:58.762] Bitwarden v2[Script Filter] Passing output '' to Conditional
[08:22:58.763] Bitwarden v2[Conditional] Processing complete
[08:22:58.764] Bitwarden v2[Conditional] Passing output '' to Arg and Vars
[08:22:58.764] Bitwarden v2[Arg and Vars] Processing complete
[08:22:58.765] Bitwarden v2[Arg and Vars] Passing output '' to Post Notification
[08:22:58.766] Bitwarden v2[Conditional] Passing output '' to Run Script
[08:23:00.158] ERROR: Bitwarden v2[Run Script] 🍺
08:22:58 workflow.go:328: -------- Bitwarden v2/2.0.1 (AwGo/0.26.2) --------
08:22:58 main.go:160: &main.options{Search:false, Config:false, SetConfigs:false, Auth:false, Sfa:false, Lock:false, Icons:false, Folder:false, Unlock:true, Login:false, Logout:false, Sync:false, Open:false, GetItem:false, Force:false, Totp:false, Last:false, Cache:false, Background:false, Id:"", Query:"", Previous:"", Attachment:"", Output:""}
08:22:58 main.go:162: args=[]string{"-unlock"} => []string{}
08:22:58 main.go:163: Workflow configs => [email: test@example.com 2FA enabled: true 2FA Mode: Authenticator-app Server: https://bitwarden.com]
08:22:59 cli.go:115: [ERROR] ==>  <nil>
08:23:00 utils.go:40: [ERROR] ==>  [Vault is locked.]
08:23:00 utils.go:52: [ERROR] ==> Exit code 1. Not unlocked. Need to unlock first. Err: Vault is locked.
08:23:00 cli.go:130: [ERROR] ==>  Not unlocked. Need to unlock first. Error:
Vault is locked.
08:23:00 utils.go:59: [DEBUG] Unexpected exit code: =>  -1
08:23:00 workflow.go:376: [ERROR] Unexpected error. Exit code -1.
08:23:00 workflow.go:379: Get help at https://github.com/blacs30/bitwarden-alfred-workflow/issues
08:23:00 workflow.go:402: ------------------ 1.338760423s ------------------
[08:23:00.185] Bitwarden v2[Run Script] Processing complete
[08:23:00.186] Bitwarden v2[Run Script] Passing output 'Unexpected error. Exit code -1.' to Post Notification

Unfortunatly I am not really comfortable with Go, otherwise I would definitely help with this.

blacs30 commented 4 years ago

@JasperV The email is read automatically from this file: "~/Library/Application\\ Support/Bitwarden\\ CLI", "data.json" if it exists.

Do you see an applescript window coming up asking for the password to unlock?

Screenshot 2020-08-06 at 09 41 53

If you logout and then try to login again a similar window should appear and ask for the password and the totp secret. I think you might not see that and therefore the exit code -1

can you confirm that?

JasperV commented 4 years ago

@blacs30,

I see. Yes, that popup window came up, only once, on initial installation. Never thereafter.

Currently, after logging out of all instances of BW, the workflow does ask me to login. But this also results in the -1 error. I do not get the popup asking for the password.

I have included the logs for this case;

[12:02:55.620] Logging Started...
[12:02:59.251] Bitwarden v2[Script Filter] Queuing argument '(null)'
[12:02:59.405] Bitwarden v2[Script Filter] Queuing argument '(null)'
[12:02:59.484] Bitwarden v2[Script Filter] Script with argv '(null)' finished
[12:02:59.486] STDERR: Bitwarden v2[Script Filter] 🍺
12:02:59 workflow.go:328: -------- Bitwarden v2/2.0.1 (AwGo/0.26.2) --------
12:02:59 main.go:160: &main.options{Search:false, Config:false, SetConfigs:false, Auth:false, Sfa:false, Lock:false, Icons:false, Folder:false, Unlock:false, Login:false, Logout:false, Sync:false, Open:false, GetItem:false, Force:false, Totp:false, Last:false, Cache:false, Background:false, Id:"", Query:"", Previous:"", Attachment:"", Output:""}
12:02:59 main.go:162: args=[]string{} => []string{}
12:02:59 main.go:163: Workflow configs => [email: test@example.com 2FA enabled: true 2FA Mode: Authenticator-app Server: https://bitwarden.com]
12:02:59 icons.go:79: progress: current=0, next=1
12:02:59 feedback.go:482: Sent 1 result(s) to Alfred
12:02:59 cli.go:514: Sync job already running.
12:02:59 icons.go:79: progress: current=0, next=1
12:02:59 feedback.go:472: Feedback already sent. Ignoring.
12:02:59 workflow.go:405: ------------------- 1.905422ms -------------------
[12:02:59.506] Bitwarden v2[Script Filter] {
  "variables": {
    "AW_SESSION_ID": "XXX",
    "RELOAD_PROGRESS": "1"
  },
  "rerun": 0.3,
  "items": [
    {
      "title": "Syncing Bitwarden secrets…",
      "valid": false,
      "icon": {
        "path": "icons/loading.png"
      }
    }
  ]
}
[12:02:59.789] Bitwarden v2[Script Filter] Queuing argument '(null)'
[12:02:59.862] Bitwarden v2[Script Filter] Script with argv '(null)' finished
[12:02:59.874] STDERR: Bitwarden v2[Script Filter] 🍺
12:02:59 workflow.go:328: -------- Bitwarden v2/2.0.1 (AwGo/0.26.2) --------
12:02:59 main.go:160: &main.options{Search:false, Config:false, SetConfigs:false, Auth:false, Sfa:false, Lock:false, Icons:false, Folder:false, Unlock:false, Login:false, Logout:false, Sync:false, Open:false, GetItem:false, Force:false, Totp:false, Last:false, Cache:false, Background:false, Id:"", Query:"", Previous:"", Attachment:"", Output:""}
12:02:59 main.go:162: args=[]string{} => []string{}
12:02:59 main.go:163: Workflow configs => [email: test@example.com 2FA enabled: true 2FA Mode: Authenticator-app Server: https://bitwarden.com]
12:02:59 icons.go:79: progress: current=1, next=2
12:02:59 feedback.go:482: Sent 1 result(s) to Alfred
12:02:59 cli.go:514: Sync job already running.
12:02:59 icons.go:79: progress: current=1, next=2
12:02:59 feedback.go:472: Feedback already sent. Ignoring.
12:02:59 workflow.go:405: ------------------- 1.311124ms -------------------
[12:02:59.876] Bitwarden v2[Script Filter] {
  "variables": {
    "AW_SESSION_ID": "XXX",
    "RELOAD_PROGRESS": "2"
  },
  "rerun": 0.3,
  "items": [
    {
      "title": "Syncing Bitwarden secrets…",
      "valid": false,
      "icon": {
        "path": "icons/loading-15.png"
      }
    }
  ]
}
[12:03:00.164] Bitwarden v2[Script Filter] Queuing argument '(null)'
[12:03:00.178] Bitwarden v2[Script Filter] Script with argv '(null)' finished
[12:03:00.179] STDERR: Bitwarden v2[Script Filter] 🍺
12:03:00 workflow.go:328: -------- Bitwarden v2/2.0.1 (AwGo/0.26.2) --------
12:03:00 main.go:160: &main.options{Search:false, Config:false, SetConfigs:false, Auth:false, Sfa:false, Lock:false, Icons:false, Folder:false, Unlock:false, Login:false, Logout:false, Sync:false, Open:false, GetItem:false, Force:false, Totp:false, Last:false, Cache:false, Background:false, Id:"", Query:"", Previous:"", Attachment:"", Output:""}
12:03:00 main.go:162: args=[]string{} => []string{}
12:03:00 main.go:163: Workflow configs => [email: test@example.com 2FA enabled: true 2FA Mode: Authenticator-app Server: https://bitwarden.com]
12:03:00 icons.go:79: progress: current=2, next=0
12:03:00 feedback.go:482: Sent 1 result(s) to Alfred
12:03:00 cli.go:514: Sync job already running.
12:03:00 icons.go:79: progress: current=2, next=0
12:03:00 feedback.go:472: Feedback already sent. Ignoring.
12:03:00 workflow.go:405: ------------------- 1.269981ms -------------------
[12:03:00.180] Bitwarden v2[Script Filter] {
  "variables": {
    "AW_SESSION_ID": "XXX",
    "RELOAD_PROGRESS": "0"
  },
  "rerun": 0.3,
  "items": [
    {
      "title": "Syncing Bitwarden secrets…",
      "valid": false,
      "icon": {
        "path": "icons/loading-30.png"
      }
    }
  ]
}
[12:03:00.478] Bitwarden v2[Script Filter] Queuing argument '(null)'
[12:03:00.550] Bitwarden v2[Script Filter] Script with argv '(null)' finished
[12:03:00.562] STDERR: Bitwarden v2[Script Filter] 🍺
12:03:00 workflow.go:328: -------- Bitwarden v2/2.0.1 (AwGo/0.26.2) --------
12:03:00 main.go:160: &main.options{Search:false, Config:false, SetConfigs:false, Auth:false, Sfa:false, Lock:false, Icons:false, Folder:false, Unlock:false, Login:false, Logout:false, Sync:false, Open:false, GetItem:false, Force:false, Totp:false, Last:false, Cache:false, Background:false, Id:"", Query:"", Previous:"", Attachment:"", Output:""}
12:03:00 main.go:162: args=[]string{} => []string{}
12:03:00 main.go:163: Workflow configs => [email: test@example.com 2FA enabled: true 2FA Mode: Authenticator-app Server: https://bitwarden.com]
12:03:00 icons.go:79: progress: current=0, next=1
12:03:00 feedback.go:482: Sent 1 result(s) to Alfred
12:03:00 cli.go:514: Sync job already running.
12:03:00 icons.go:79: progress: current=0, next=1
12:03:00 feedback.go:472: Feedback already sent. Ignoring.
12:03:00 workflow.go:405: ------------------- 1.291299ms -------------------
[12:03:00.564] Bitwarden v2[Script Filter] {
  "variables": {
    "AW_SESSION_ID": "XXX",
    "RELOAD_PROGRESS": "1"
  },
  "rerun": 0.3,
  "items": [
    {
      "title": "Syncing Bitwarden secrets…",
      "valid": false,
      "icon": {
        "path": "icons/loading.png"
      }
    }
  ]
}
[12:03:00.827] Bitwarden v2[Script Filter] Queuing argument 'login'
[12:03:00.846] Bitwarden v2[Script Filter] Script with argv 'login' finished
[12:03:00.856] STDERR: Bitwarden v2[Script Filter] 🍺
12:03:00 workflow.go:328: -------- Bitwarden v2/2.0.1 (AwGo/0.26.2) --------
12:03:00 main.go:160: &main.options{Search:false, Config:false, SetConfigs:false, Auth:true, Sfa:false, Lock:false, Icons:false, Folder:false, Unlock:false, Login:false, Logout:false, Sync:false, Open:false, GetItem:false, Force:false, Totp:false, Last:false, Cache:false, Background:false, Id:"", Query:"login", Previous:"", Attachment:"", Output:""}
12:03:00 main.go:162: args=[]string{"-auth", "--", "login"} => []string{"login"}
12:03:00 main.go:163: Workflow configs => [email: test@example.com 2FA enabled: true 2FA Mode: Authenticator-app Server: https://bitwarden.com]
12:03:00 cli.go:297: filtering auth config "login" ...
12:03:00 feedback.go:482: Sent 1 result(s) to Alfred
12:03:00 workflow.go:405: ------------------- 3.725831ms -------------------
[12:03:00.857] Bitwarden v2[Script Filter] {
  "variables": {
    "AW_SESSION_ID": "XXX"
  },
  "items": [
    {
      "title": "Login to Bitwarden",
      "subtitle": "↩ or ⇥ to login now",
      "uid": "login",
      "valid": true,
      "icon": {
        "path": "icons/on.png"
      },
      "variables": {
        "action": "-login"
      }
    }
  ]
}
[12:03:03.187] Bitwarden v2[Script Filter] Processing complete
[12:03:03.191] Bitwarden v2[Script Filter] Passing output '' to Conditional
[12:03:03.192] Bitwarden v2[Conditional] Processing complete
[12:03:03.211] Bitwarden v2[Conditional] Passing output '' to Arg and Vars
[12:03:03.212] Bitwarden v2[Arg and Vars] Processing complete
[12:03:03.212] Bitwarden v2[Arg and Vars] Passing output '' to Post Notification
[12:03:03.213] Bitwarden v2[Conditional] Passing output '' to Run Script
[12:03:04.567] ERROR: Bitwarden v2[Run Script] 🍺
12:03:03 workflow.go:328: -------- Bitwarden v2/2.0.1 (AwGo/0.26.2) --------
12:03:03 main.go:160: &main.options{Search:false, Config:false, SetConfigs:false, Auth:false, Sfa:false, Lock:false, Icons:false, Folder:false, Unlock:false, Login:true, Logout:false, Sync:false, Open:false, GetItem:false, Force:false, Totp:false, Last:false, Cache:false, Background:false, Id:"", Query:"", Previous:"", Attachment:"", Output:""}
12:03:03 main.go:162: args=[]string{"-login"} => []string{}
12:03:03 main.go:163: Workflow configs => [email: test@example.com 2FA enabled: true 2FA Mode: Authenticator-app Server: https://bitwarden.com]
12:03:03 utils.go:40: [ERROR] ==>  [You are not logged in.]
12:03:03 utils.go:52: [ERROR] ==> Exit code 1. Not logged in. Need to login first. Err: You are not logged in.
12:03:03 cli.go:115: [ERROR] ==>  Not logged in. Need to login first. Error:
You are not logged in.
12:03:04 utils.go:40: [ERROR] ==>  [Vault is locked.]
12:03:04 utils.go:52: [ERROR] ==> Exit code 1. Not unlocked. Need to unlock first. Err: Vault is locked.
12:03:04 cli.go:130: [ERROR] ==>  Not unlocked. Need to unlock first. Error:
Vault is locked.
12:03:04 utils.go:59: [DEBUG] Unexpected exit code: =>  -1
12:03:04 workflow.go:376: [ERROR] Unexpected error. Exit code -1.
12:03:04 workflow.go:379: Get help at https://github.com/blacs30/bitwarden-alfred-workflow/issues
12:03:04 workflow.go:402: ------------------ 1.305603176s ------------------
[12:03:04.594] Bitwarden v2[Run Script] Processing complete
[12:03:04.595] Bitwarden v2[Run Script] Passing output 'Unexpected error. Exit code -1.' to Post Notification
blacs30 commented 4 years ago

@JasperV thanks for that information. can you please run this command inside of the workflow folder osascript bitwarden-js-pw-promot.js Unlock <EMAIL> password true

this should run the popup too, I suspect an issue somewhere there.

Maybe I should see if I can create natively in go a ui for entering the password and email. I think the alfred workflow itself doesn't support hidden entries.

JasperV commented 4 years ago

@blacs30,

Yes, that gave me the popup and worked fine. It does not make the workflow work however.

blacs30 commented 4 years ago

@JasperV can you try and see if this release fixes your issue?

JasperV commented 4 years ago

@blacs30,

Thanks for all the effort!

There is something that does not quite work yet. Different error this time;

[11:20:08.439] Bitwarden v2[Script Filter] Processing complete
[11:20:08.441] Bitwarden v2[Script Filter] Passing output '(
    unlock,
    "test@example.com"
)' to Conditional
[11:20:08.443] Bitwarden v2[Conditional] Processing complete
[11:20:08.443] Bitwarden v2[Conditional] Passing output '(
    unlock,
    "test@example.com"
)' to Run Script
[11:20:08.507] ERROR: Bitwarden v2[Run Script] /Users/jasper/Library/Caches/com.runningwithcrayons.Alfred/Workflow Scripts/F7521820-8131-491C-9BF1-26B562B8AE74: line 1: osascript: command not found
[11:20:08.523] Bitwarden v2[Run Script] Processing complete
[11:20:08.524] Bitwarden v2[Run Script] Passing output '' to Post Notification
blacs30 commented 4 years ago

@JasperV thanks for your patience, the osascript executable wasn't found in the path, I've hard coded the path to it now as it is a system internal executable (running applescripts and also javascript nowadays)

Can you please try the new release 2.0.3 thank you!

JasperV commented 4 years ago

Hi @blacs30,

This works. I am able to use it now! Thanks for all the effort!

Cheers,

Jasper

blacs30 commented 4 years ago

Great, thanks for the feedback. glad to hear that.