Jump to content

Bitwarden CLI - Get passwords, username, TOTP and more from Bitwarden


Recommended Posts

35 minutes ago, jpizzle said:

@blacs30

 

I have done this with both versions and fuzzy filtering was great in 2.2.x. In 2.4.x it is almost unusable.

 

Sometimes I'll type in the name of the item exactly and it still won't populate at the top of the results.

 

I just tried it the fuzzy filtering (de-selected Alfreds filter results for the "Search Bitwarden" item). The results were quite good for me. But I had disabled TITLE_WITH_URLS and TITLE_WITH_USER. With those two configs enabled the results are not so good. Maybe it's easier when the text is shorter? I've also set REORDERING_DISABLED to false now to test it little bit more in real live to have my frequently used items on the top.

Link to comment
On 3/10/2022 at 11:20 AM, blacs30 said:

Mh not sure why. For me it worked fine. Hopefully next time again automatically.

image.png.3c06aa1739f435639879bdfc466ea608.png

 

 

this is shown until I close alfred somehow - and the workflow hasnt updated :(, are you using this aswell? 

Link to comment
On 1/17/2022 at 3:17 PM, blacs30 said:

 

Others seem to run the workflow fine on macOS 12.

- Please update to the latest workflow if you haven't already (https://github.com/blacs30/bitwarden-alfred-workflow/releases/tag/2.4.1)

- remove the one entry in keychain access

 

- use the Bitwarden CLI in the terminal to check that the login works fine (try OTP or email as second factor first)

- then try to use the Alfred Bitwarden again 

 

I am having this same problem (on Monterey, with v2.4.3 of the workflow, the latest CLI, Alfred granted full access). I seem to login successfully the first time, but when I go to do anything else such as sync, I have to log in again, and get stuck in a loop. Like @dhahn, I only have the one Keychain entry, for application password.

 

Additionally, each time I try to log in after the first time, I get the following error:

[14:01:55.747] Bitwarden v2[Script Filter] Processing complete
[14:01:55.748] Bitwarden v2[Script Filter] Passing output '' to Conditional
[14:01:55.749] Bitwarden v2[Conditional] Processing complete
[14:01:55.750] Bitwarden v2[Conditional] Passing output '' to Run Script
[14:02:07.612] STDERR: Bitwarden v2[Run Script] Error: security: SecKeychainItemCreateFromContent (<default>): The specified item already exists in the keychain.
[14:02:07.619] Bitwarden v2[Run Script] Processing complete
[14:02:07.620] Bitwarden v2[Run Script] Passing output '' to Post Notification

 

 

Link to comment
2 hours ago, jpm said:

 

I am having this same problem (on Monterey, with v2.4.3 of the workflow, the latest CLI, Alfred granted full access). I seem to login successfully the first time, but when I go to do anything else such as sync, I have to log in again, and get stuck in a loop. Like @dhahn, I only have the one Keychain entry, for application password.

 

Additionally, each time I try to log in after the first time, I get the following error:

[14:01:55.747] Bitwarden v2[Script Filter] Processing complete
[14:01:55.748] Bitwarden v2[Script Filter] Passing output '' to Conditional
[14:01:55.749] Bitwarden v2[Conditional] Processing complete
[14:01:55.750] Bitwarden v2[Conditional] Passing output '' to Run Script
[14:02:07.612] STDERR: Bitwarden v2[Run Script] Error: security: SecKeychainItemCreateFromContent (<default>): The specified item already exists in the keychain.
[14:02:07.619] Bitwarden v2[Run Script] Processing complete
[14:02:07.620] Bitwarden v2[Run Script] Passing output '' to Post Notification

 

 

Can you try and delete all `com.lisowski-development.alfred.bitwarden` items from keychain and run the login process again? It fails here in the javascript where it would write the received token into keychain.

Link to comment
On 3/17/2022 at 4:16 PM, blacs30 said:

Can you try and delete all `com.lisowski-development.alfred.bitwarden` items from keychain and run the login process again? It fails here in the javascript where it would write the received token into keychain.

 

Sorry, should have said that I already tried that.

Link to comment
On 3/18/2022 at 7:00 PM, jpm said:

 

Sorry, should have said that I already tried that.

Mh, difficult to guess what's the problem here.
My Alfred has access in the privacy config to Automation, Full Disk access and Accessibility. Not sure if that helps.

Link to comment
2 hours ago, blacs30 said:

Mh, difficult to guess what's the problem here.
My Alfred has access in the privacy config to Automation, Full Disk access and Accessibility. Not sure if that helps.

Mine has the same access. I'll try removing and reinstalling everything.

Link to comment
57 minutes ago, jpm said:

Mine has the same access. I'll try removing and reinstalling everything.

 

Just done so (removed CLI, workflow, keychain entry, Privacy pane entries, restarted Mac). Same problem remains.

Link to comment
8 minutes ago, blacs30 said:

Oh. I will check the script later once more. Was it ever working for you before?

I'm afraid not. When I first login, I get a notification of success, but then everything I do after that redirects me to login again.

 

If it's any use, here is the log when I log in then (try to) log out immediately afterwards.

 

[15:58:53.279] Bitwarden v2[Script Filter] Queuing argument '(null)'
[15:58:53.378] Bitwarden v2[Script Filter] Script with argv '(null)' finished
[15:58:53.380] STDERR: Bitwarden v2[Script Filter] 🍺
15:58:53 workflow.go:328: -------- Bitwarden v2/2.4.3 (AwGo/0.27.1) --------
15:58:53 main.go:162: &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, Background:false, Id:"", Query:"", Attachment:"", Output:""}
15:58:53 main.go:164: args=[]string{"-auth", "--", ""} => []string{""}
15:58:53 main.go:165: (main.config) {
 AutoFetchIconCacheAge: (int) 1440,
 AutoFetchIconMaxCacheAge: (time.Duration) 24h0m0s,
 BwconfKeyword: (string) (len=9) ".bwconfig",
 BwauthKeyword: (string) (len=7) ".bwauth",
 BwKeyword: (string) (len=3) ".bw",
 BwfKeyword: (string) (len=4) ".bwf",
 BwExec: (string) (len=2) "bw",
 BwDataPath: (string) "",
 Debug: (bool) false,
 Email: (string) (len=23) "foo@fastmail.com",
 EmptyDetailResults: (bool) false,
 IconCacheAge: (int) 43200,
 IconCacheEnabled: (bool) true,
 IconMaxCacheAge: (time.Duration) 720h0m0s,
 MaxResults: (int) 1000,
 Mod1: (string) (len=3) "alt",
 Mod1Action: (string) (len=13) "username,code",
 Mod2: (string) (len=5) "shift",
 Mod2Action: (string) (len=3) "url",
 Mod3: (string) (len=4) "ctrl",
 Mod3Action: (string) (len=4) "totp",
 Mod4: (string) (len=7) "cmd,opt",
 Mod4Action: (string) (len=4) "more",
 NoModAction: (string) (len=13) "password,card",
 OutputFolder: (string) (len=34) "/Users/foo/Downloads/",
 Path: (string) (len=101) "/usr/bin:/usr/local/bin:/usr/local/sbin:/usr/local/share/npm/bin:/usr/bin:/usr/sbin:/opt/homebrew/bin",
 ReorderingDisabled: (bool) true,
 Server: (string) "",
 Sfa: (bool) false,
 SfaMode: (int) 0,
 SkipTypes: (string) "",
 SyncCacheAge: (int) 10080,
 SyncMaxCacheAge: (time.Duration) 168h0m0s,
 TitleWithUser: (bool) true,
 TitleWithUrls: (bool) true,
 OpenLoginUrl: (bool) true
}
15:58:53 cli.go:303: filtering auth config "" ...
15:58:53 feedback.go:509: Sent 4 result(s) to Alfred
15:58:53 workflow.go:405: ------------------- 2.542125ms -------------------
[15:58:53.383] Bitwarden v2[Script Filter] {
  "variables": {
    "AW_SESSION_ID": "CTSNJDEAKYFSPC6HTND8N0UA"
  },
  "items": [
    {
      "title": "Login to Bitwarden",
      "subtitle": "↩ or ⇥ to login now",
      "valid": true,
      "icon": {
        "path": "icons/on.png"
      },
      "variables": {
        "action": "-login",
        "email": "foo@fastmail.com",
        "mapsfamode": " ",
        "sfamode": "-1",
        "type": "login"
      }
    },
    {
      "title": "Logout",
      "subtitle": "Logout from Bitwarden",
      "valid": true,
      "icon": {
        "path": "icons/off.png"
      },
      "variables": {
        "action": "-logout"
      }
    },
    {
      "title": "Unlock",
      "subtitle": "Unlock Bitwarden",
      "valid": true,
      "icon": {
        "path": "icons/on.png"
      },
      "variables": {
        "action": "-unlock",
        "email": "foo@fastmail.com",
        "type": "unlock"
      }
    },
    {
      "title": "Lock",
      "subtitle": "Lock Bitwarden",
      "valid": true,
      "icon": {
        "path": "icons/off.png"
      },
      "variables": {
        "action": "-lock"
      }
    }
  ]
}
[15:58:54.927] Bitwarden v2[Script Filter] Processing complete
[15:58:54.928] Bitwarden v2[Script Filter] Passing output '' to Conditional
[15:58:54.928] Bitwarden v2[Conditional] Processing complete
[15:58:54.929] Bitwarden v2[Conditional] Passing output '' to Run Script
[15:59:03.765] Bitwarden v2[Run Script] Processing complete
[15:59:03.773] Bitwarden v2[Run Script] Passing output 'Logged in.
' to Post Notification
[15:59:05.532] Bitwarden v2[Script Filter] Queuing argument '(null)'
[15:59:05.647] Bitwarden v2[Script Filter] Script with argv '(null)' finished
[15:59:05.648] STDERR: Bitwarden v2[Script Filter] 🍺
15:59:05 workflow.go:328: -------- Bitwarden v2/2.4.3 (AwGo/0.27.1) --------
15:59:05 main.go:162: &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, Background:false, Id:"", Query:"", Attachment:"", Output:""}
15:59:05 main.go:164: args=[]string{"-auth", "--", ""} => []string{""}
15:59:05 main.go:165: (main.config) {
 AutoFetchIconCacheAge: (int) 1440,
 AutoFetchIconMaxCacheAge: (time.Duration) 24h0m0s,
 BwconfKeyword: (string) (len=9) ".bwconfig",
 BwauthKeyword: (string) (len=7) ".bwauth",
 BwKeyword: (string) (len=3) ".bw",
 BwfKeyword: (string) (len=4) ".bwf",
 BwExec: (string) (len=2) "bw",
 BwDataPath: (string) "",
 Debug: (bool) false,
 Email: (string) (len=23) "foo@fastmail.com",
 EmptyDetailResults: (bool) false,
 IconCacheAge: (int) 43200,
 IconCacheEnabled: (bool) true,
 IconMaxCacheAge: (time.Duration) 720h0m0s,
 MaxResults: (int) 1000,
 Mod1: (string) (len=3) "alt",
 Mod1Action: (string) (len=13) "username,code",
 Mod2: (string) (len=5) "shift",
 Mod2Action: (string) (len=3) "url",
 Mod3: (string) (len=4) "ctrl",
 Mod3Action: (string) (len=4) "totp",
 Mod4: (string) (len=7) "cmd,opt",
 Mod4Action: (string) (len=4) "more",
 NoModAction: (string) (len=13) "password,card",
 OutputFolder: (string) (len=34) "/Users/foo/Downloads/",
 Path: (string) (len=101) "/usr/bin:/usr/local/bin:/usr/local/sbin:/usr/local/share/npm/bin:/usr/bin:/usr/sbin:/opt/homebrew/bin",
 ReorderingDisabled: (bool) true,
 Server: (string) "",
 Sfa: (bool) false,
 SfaMode: (int) 0,
 SkipTypes: (string) "",
 SyncCacheAge: (int) 10080,
 SyncMaxCacheAge: (time.Duration) 168h0m0s,
 TitleWithUser: (bool) true,
 TitleWithUrls: (bool) true,
 OpenLoginUrl: (bool) true
}
15:59:05 cli.go:303: filtering auth config "" ...
15:59:05 feedback.go:509: Sent 4 result(s) to Alfred
15:59:05 workflow.go:405: ------------------- 2.795916ms -------------------
[15:59:05.652] Bitwarden v2[Script Filter] {
  "variables": {
    "AW_SESSION_ID": "G77DBL59DWUFZTQX1HU9ABVF"
  },
  "items": [
    {
      "title": "Login to Bitwarden",
      "subtitle": "↩ or ⇥ to login now",
      "valid": true,
      "icon": {
        "path": "icons/on.png"
      },
      "variables": {
        "action": "-login",
        "email": "foo@fastmail.com",
        "mapsfamode": " ",
        "sfamode": "-1",
        "type": "login"
      }
    },
    {
      "title": "Logout",
      "subtitle": "Logout from Bitwarden",
      "valid": true,
      "icon": {
        "path": "icons/off.png"
      },
      "variables": {
        "action": "-logout"
      }
    },
    {
      "title": "Unlock",
      "subtitle": "Unlock Bitwarden",
      "valid": true,
      "icon": {
        "path": "icons/on.png"
      },
      "variables": {
        "action": "-unlock",
        "email": "foo@fastmail.com",
        "type": "unlock"
      }
    },
    {
      "title": "Lock",
      "subtitle": "Lock Bitwarden",
      "valid": true,
      "icon": {
        "path": "icons/off.png"
      },
      "variables": {
        "action": "-lock"
      }
    }
  ]
}
[15:59:06.739] Bitwarden v2[Script Filter] Processing complete
[15:59:06.745] Bitwarden v2[Script Filter] Passing output '' to Conditional
[15:59:06.746] Bitwarden v2[Conditional] Processing complete
[15:59:06.746] Bitwarden v2[Conditional] Passing output '' to Hide Alfred
[15:59:06.747] Bitwarden v2[Hide Alfred] Processing complete
[15:59:06.748] Bitwarden v2[Hide Alfred] Passing output '' to Run Script
[15:59:07.438] ERROR: Bitwarden v2[Run Script] 🍺
15:59:06 workflow.go:328: -------- Bitwarden v2/2.4.3 (AwGo/0.27.1) --------
15:59:06 main.go:162: &main.options{Search:false, Config:false, SetConfigs:false, Auth:false, Sfa:false, Lock:false, Icons:false, Folder:false, Unlock:false, Login:false, Logout:true, Sync:false, Open:false, GetItem:false, Force:false, Totp:false, Last:false, Background:false, Id:"", Query:"", Attachment:"", Output:""}
15:59:06 main.go:164: args=[]string{"-logout"} => []string{}
15:59:06 main.go:165: (main.config) {
 AutoFetchIconCacheAge: (int) 1440,
 AutoFetchIconMaxCacheAge: (time.Duration) 24h0m0s,
 BwconfKeyword: (string) (len=9) ".bwconfig",
 BwauthKeyword: (string) (len=7) ".bwauth",
 BwKeyword: (string) (len=3) ".bw",
 BwfKeyword: (string) (len=4) ".bwf",
 BwExec: (string) (len=2) "bw",
 BwDataPath: (string) "",
 Debug: (bool) false,
 Email: (string) (len=23) "foo@fastmail.com",
 EmptyDetailResults: (bool) false,
 IconCacheAge: (int) 43200,
 IconCacheEnabled: (bool) true,
 IconMaxCacheAge: (time.Duration) 720h0m0s,
 MaxResults: (int) 1000,
 Mod1: (string) (len=3) "alt",
 Mod1Action: (string) (len=13) "username,code",
 Mod2: (string) (len=5) "shift",
 Mod2Action: (string) (len=3) "url",
 Mod3: (string) (len=4) "ctrl",
 Mod3Action: (string) (len=4) "totp",
 Mod4: (string) (len=7) "cmd,opt",
 Mod4Action: (string) (len=4) "more",
 NoModAction: (string) (len=13) "password,card",
 OutputFolder: (string) (len=34) "/Users/foo/Downloads/",
 Path: (string) (len=101) "/usr/bin:/usr/local/bin:/usr/local/sbin:/usr/local/share/npm/bin:/usr/bin:/usr/sbin:/opt/homebrew/bin",
 ReorderingDisabled: (bool) true,
 Server: (string) "",
 Sfa: (bool) false,
 SfaMode: (int) 0,
 SkipTypes: (string) "",
 SyncCacheAge: (int) 10080,
 SyncMaxCacheAge: (time.Duration) 168h0m0s,
 TitleWithUser: (bool) true,
 TitleWithUrls: (bool) true,
 OpenLoginUrl: (bool) true
}
15:59:06 bitwarden.go:544: Clearing items cache.
15:59:06 files.go:49: deleted contents of "/Users/foo/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/com.lisowski-development.alfred.bitwarden"
15:59:07 utils.go:30: [ERROR] ==>  [You are not logged in.]
15:59:07 utils.go:42: [ERROR] ==> Exit code 1. Logout of Bitwarden failed. Err: You are not logged in.
15:59:07 workflow.go:376: [ERROR] Logout of Bitwarden failed. Error:
You are not logged in.
15:59:07 workflow.go:379: Get help at https://github.com/blacs30/bitwarden-alfred-workflow/issues
15:59:07 workflow.go:402: ------------------ 675.44425ms -------------------
[15:59:07.459] Bitwarden v2[Run Script] Processing complete
[15:59:07.460] Bitwarden v2[Run Script] Passing output 'Logout of Bitwarden failed. Error:
You are not logged in.' to Post Notification

 

Link to comment
6 hours ago, jpm said:

I'm afraid not. When I first login, I get a notification of success, but then everything I do after that redirects me to login again.

 

If it's any use, here is the log when I log in then (try to) log out immediately afterwards.

 

[15:58:53.279] Bitwarden v2[Script Filter] Queuing argument '(null)'
[15:58:53.378] Bitwarden v2[Script Filter] Script with argv '(null)' finished
[15:58:53.380] STDERR: Bitwarden v2[Script Filter] 🍺
15:58:53 workflow.go:328: -------- Bitwarden v2/2.4.3 (AwGo/0.27.1) --------
15:58:53 main.go:162: &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, Background:false, Id:"", Query:"", Attachment:"", Output:""}
15:58:53 main.go:164: args=[]string{"-auth", "--", ""} => []string{""}
15:58:53 main.go:165: (main.config) {
 AutoFetchIconCacheAge: (int) 1440,
 AutoFetchIconMaxCacheAge: (time.Duration) 24h0m0s,
 BwconfKeyword: (string) (len=9) ".bwconfig",
 BwauthKeyword: (string) (len=7) ".bwauth",
 BwKeyword: (string) (len=3) ".bw",
 BwfKeyword: (string) (len=4) ".bwf",
 BwExec: (string) (len=2) "bw",
 BwDataPath: (string) "",
 Debug: (bool) false,
 Email: (string) (len=23) "foo@fastmail.com",
 EmptyDetailResults: (bool) false,
 IconCacheAge: (int) 43200,
 IconCacheEnabled: (bool) true,
 IconMaxCacheAge: (time.Duration) 720h0m0s,
 MaxResults: (int) 1000,
 Mod1: (string) (len=3) "alt",
 Mod1Action: (string) (len=13) "username,code",
 Mod2: (string) (len=5) "shift",
 Mod2Action: (string) (len=3) "url",
 Mod3: (string) (len=4) "ctrl",
 Mod3Action: (string) (len=4) "totp",
 Mod4: (string) (len=7) "cmd,opt",
 Mod4Action: (string) (len=4) "more",
 NoModAction: (string) (len=13) "password,card",
 OutputFolder: (string) (len=34) "/Users/foo/Downloads/",
 Path: (string) (len=101) "/usr/bin:/usr/local/bin:/usr/local/sbin:/usr/local/share/npm/bin:/usr/bin:/usr/sbin:/opt/homebrew/bin",
 ReorderingDisabled: (bool) true,
 Server: (string) "",
 Sfa: (bool) false,
 SfaMode: (int) 0,
 SkipTypes: (string) "",
 SyncCacheAge: (int) 10080,
 SyncMaxCacheAge: (time.Duration) 168h0m0s,
 TitleWithUser: (bool) true,
 TitleWithUrls: (bool) true,
 OpenLoginUrl: (bool) true
}
15:58:53 cli.go:303: filtering auth config "" ...
15:58:53 feedback.go:509: Sent 4 result(s) to Alfred
15:58:53 workflow.go:405: ------------------- 2.542125ms -------------------
[15:58:53.383] Bitwarden v2[Script Filter] {
  "variables": {
    "AW_SESSION_ID": "CTSNJDEAKYFSPC6HTND8N0UA"
  },
  "items": [
    {
      "title": "Login to Bitwarden",
      "subtitle": "↩ or ⇥ to login now",
      "valid": true,
      "icon": {
        "path": "icons/on.png"
      },
      "variables": {
        "action": "-login",
        "email": "foo@fastmail.com",
        "mapsfamode": " ",
        "sfamode": "-1",
        "type": "login"
      }
    },
    {
      "title": "Logout",
      "subtitle": "Logout from Bitwarden",
      "valid": true,
      "icon": {
        "path": "icons/off.png"
      },
      "variables": {
        "action": "-logout"
      }
    },
    {
      "title": "Unlock",
      "subtitle": "Unlock Bitwarden",
      "valid": true,
      "icon": {
        "path": "icons/on.png"
      },
      "variables": {
        "action": "-unlock",
        "email": "foo@fastmail.com",
        "type": "unlock"
      }
    },
    {
      "title": "Lock",
      "subtitle": "Lock Bitwarden",
      "valid": true,
      "icon": {
        "path": "icons/off.png"
      },
      "variables": {
        "action": "-lock"
      }
    }
  ]
}
[15:58:54.927] Bitwarden v2[Script Filter] Processing complete
[15:58:54.928] Bitwarden v2[Script Filter] Passing output '' to Conditional
[15:58:54.928] Bitwarden v2[Conditional] Processing complete
[15:58:54.929] Bitwarden v2[Conditional] Passing output '' to Run Script
[15:59:03.765] Bitwarden v2[Run Script] Processing complete
[15:59:03.773] Bitwarden v2[Run Script] Passing output 'Logged in.
' to Post Notification
[15:59:05.532] Bitwarden v2[Script Filter] Queuing argument '(null)'
[15:59:05.647] Bitwarden v2[Script Filter] Script with argv '(null)' finished
[15:59:05.648] STDERR: Bitwarden v2[Script Filter] 🍺
15:59:05 workflow.go:328: -------- Bitwarden v2/2.4.3 (AwGo/0.27.1) --------
15:59:05 main.go:162: &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, Background:false, Id:"", Query:"", Attachment:"", Output:""}
15:59:05 main.go:164: args=[]string{"-auth", "--", ""} => []string{""}
15:59:05 main.go:165: (main.config) {
 AutoFetchIconCacheAge: (int) 1440,
 AutoFetchIconMaxCacheAge: (time.Duration) 24h0m0s,
 BwconfKeyword: (string) (len=9) ".bwconfig",
 BwauthKeyword: (string) (len=7) ".bwauth",
 BwKeyword: (string) (len=3) ".bw",
 BwfKeyword: (string) (len=4) ".bwf",
 BwExec: (string) (len=2) "bw",
 BwDataPath: (string) "",
 Debug: (bool) false,
 Email: (string) (len=23) "foo@fastmail.com",
 EmptyDetailResults: (bool) false,
 IconCacheAge: (int) 43200,
 IconCacheEnabled: (bool) true,
 IconMaxCacheAge: (time.Duration) 720h0m0s,
 MaxResults: (int) 1000,
 Mod1: (string) (len=3) "alt",
 Mod1Action: (string) (len=13) "username,code",
 Mod2: (string) (len=5) "shift",
 Mod2Action: (string) (len=3) "url",
 Mod3: (string) (len=4) "ctrl",
 Mod3Action: (string) (len=4) "totp",
 Mod4: (string) (len=7) "cmd,opt",
 Mod4Action: (string) (len=4) "more",
 NoModAction: (string) (len=13) "password,card",
 OutputFolder: (string) (len=34) "/Users/foo/Downloads/",
 Path: (string) (len=101) "/usr/bin:/usr/local/bin:/usr/local/sbin:/usr/local/share/npm/bin:/usr/bin:/usr/sbin:/opt/homebrew/bin",
 ReorderingDisabled: (bool) true,
 Server: (string) "",
 Sfa: (bool) false,
 SfaMode: (int) 0,
 SkipTypes: (string) "",
 SyncCacheAge: (int) 10080,
 SyncMaxCacheAge: (time.Duration) 168h0m0s,
 TitleWithUser: (bool) true,
 TitleWithUrls: (bool) true,
 OpenLoginUrl: (bool) true
}
15:59:05 cli.go:303: filtering auth config "" ...
15:59:05 feedback.go:509: Sent 4 result(s) to Alfred
15:59:05 workflow.go:405: ------------------- 2.795916ms -------------------
[15:59:05.652] Bitwarden v2[Script Filter] {
  "variables": {
    "AW_SESSION_ID": "G77DBL59DWUFZTQX1HU9ABVF"
  },
  "items": [
    {
      "title": "Login to Bitwarden",
      "subtitle": "↩ or ⇥ to login now",
      "valid": true,
      "icon": {
        "path": "icons/on.png"
      },
      "variables": {
        "action": "-login",
        "email": "foo@fastmail.com",
        "mapsfamode": " ",
        "sfamode": "-1",
        "type": "login"
      }
    },
    {
      "title": "Logout",
      "subtitle": "Logout from Bitwarden",
      "valid": true,
      "icon": {
        "path": "icons/off.png"
      },
      "variables": {
        "action": "-logout"
      }
    },
    {
      "title": "Unlock",
      "subtitle": "Unlock Bitwarden",
      "valid": true,
      "icon": {
        "path": "icons/on.png"
      },
      "variables": {
        "action": "-unlock",
        "email": "foo@fastmail.com",
        "type": "unlock"
      }
    },
    {
      "title": "Lock",
      "subtitle": "Lock Bitwarden",
      "valid": true,
      "icon": {
        "path": "icons/off.png"
      },
      "variables": {
        "action": "-lock"
      }
    }
  ]
}
[15:59:06.739] Bitwarden v2[Script Filter] Processing complete
[15:59:06.745] Bitwarden v2[Script Filter] Passing output '' to Conditional
[15:59:06.746] Bitwarden v2[Conditional] Processing complete
[15:59:06.746] Bitwarden v2[Conditional] Passing output '' to Hide Alfred
[15:59:06.747] Bitwarden v2[Hide Alfred] Processing complete
[15:59:06.748] Bitwarden v2[Hide Alfred] Passing output '' to Run Script
[15:59:07.438] ERROR: Bitwarden v2[Run Script] 🍺
15:59:06 workflow.go:328: -------- Bitwarden v2/2.4.3 (AwGo/0.27.1) --------
15:59:06 main.go:162: &main.options{Search:false, Config:false, SetConfigs:false, Auth:false, Sfa:false, Lock:false, Icons:false, Folder:false, Unlock:false, Login:false, Logout:true, Sync:false, Open:false, GetItem:false, Force:false, Totp:false, Last:false, Background:false, Id:"", Query:"", Attachment:"", Output:""}
15:59:06 main.go:164: args=[]string{"-logout"} => []string{}
15:59:06 main.go:165: (main.config) {
 AutoFetchIconCacheAge: (int) 1440,
 AutoFetchIconMaxCacheAge: (time.Duration) 24h0m0s,
 BwconfKeyword: (string) (len=9) ".bwconfig",
 BwauthKeyword: (string) (len=7) ".bwauth",
 BwKeyword: (string) (len=3) ".bw",
 BwfKeyword: (string) (len=4) ".bwf",
 BwExec: (string) (len=2) "bw",
 BwDataPath: (string) "",
 Debug: (bool) false,
 Email: (string) (len=23) "foo@fastmail.com",
 EmptyDetailResults: (bool) false,
 IconCacheAge: (int) 43200,
 IconCacheEnabled: (bool) true,
 IconMaxCacheAge: (time.Duration) 720h0m0s,
 MaxResults: (int) 1000,
 Mod1: (string) (len=3) "alt",
 Mod1Action: (string) (len=13) "username,code",
 Mod2: (string) (len=5) "shift",
 Mod2Action: (string) (len=3) "url",
 Mod3: (string) (len=4) "ctrl",
 Mod3Action: (string) (len=4) "totp",
 Mod4: (string) (len=7) "cmd,opt",
 Mod4Action: (string) (len=4) "more",
 NoModAction: (string) (len=13) "password,card",
 OutputFolder: (string) (len=34) "/Users/foo/Downloads/",
 Path: (string) (len=101) "/usr/bin:/usr/local/bin:/usr/local/sbin:/usr/local/share/npm/bin:/usr/bin:/usr/sbin:/opt/homebrew/bin",
 ReorderingDisabled: (bool) true,
 Server: (string) "",
 Sfa: (bool) false,
 SfaMode: (int) 0,
 SkipTypes: (string) "",
 SyncCacheAge: (int) 10080,
 SyncMaxCacheAge: (time.Duration) 168h0m0s,
 TitleWithUser: (bool) true,
 TitleWithUrls: (bool) true,
 OpenLoginUrl: (bool) true
}
15:59:06 bitwarden.go:544: Clearing items cache.
15:59:06 files.go:49: deleted contents of "/Users/foo/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/com.lisowski-development.alfred.bitwarden"
15:59:07 utils.go:30: [ERROR] ==>  [You are not logged in.]
15:59:07 utils.go:42: [ERROR] ==> Exit code 1. Logout of Bitwarden failed. Err: You are not logged in.
15:59:07 workflow.go:376: [ERROR] Logout of Bitwarden failed. Error:
You are not logged in.
15:59:07 workflow.go:379: Get help at https://github.com/blacs30/bitwarden-alfred-workflow/issues
15:59:07 workflow.go:402: ------------------ 675.44425ms -------------------
[15:59:07.459] Bitwarden v2[Run Script] Processing complete
[15:59:07.460] Bitwarden v2[Run Script] Passing output 'Logout of Bitwarden failed. Error:
You are not logged in.' to Post Notification

 

Thanks for the logs. 
2 more things I haven't asked yet;

- Does the bw login work fine in the terminal? Can you try that, and once you are logged in, then the alfred workflow just needs an unlock

- run a normal `bw logout` in the terminal and then delete this file: `rm ~/Library/Application\ Support/Bitwarden\ CLI/data.json` (it contains the encrypted secrets, loaded from the bitwarden server); then run bw login again, via terminal and/or via workflow

Link to comment
13 hours ago, blacs30 said:

Thanks for the logs. 
2 more things I haven't asked yet;

- Does the bw login work fine in the terminal? Can you try that, and once you are logged in, then the alfred workflow just needs an unlock

It does! And as you suggest, I can then unlock and lock without problem. Also, I now have 2 Keychain entries.

 

13 hours ago, blacs30 said:

- run a normal `bw logout` in the terminal and then delete this file: `rm ~/Library/Application\ Support/Bitwarden\ CLI/data.json` (it contains the encrypted secrets, loaded from the bitwarden server); then run bw login again, via terminal and/or via workflow

That works fine. It also asks for my client_secret when I log back in for the first time. Also, each time I use client_secret, Bitwarden thinks I'm logging in from a new device (I get an email).

 

I still have one minor issue. If I log out via the workflow, then trigger the workflow again (either via shortcut or '.bw'), it no longer shows the 'logged out', 'log in' options, but the 'locked', 'unlock' ones instead. If I select those then unlock via password, I get notified that I'm not logged in, but don't get sent to a login field.

 

Basically, I can easily login in by going to '.bwauth', but the workflow isn't putting login options up front when I'm logged out.

 

Thanks for all your help here. Happy to send more logs if it helps.

 

Link to comment
1 minute ago, jpm said:

It does! And as you suggest, I can then unlock and lock without problem. Also, I now have 2 Keychain entries.

 

That works fine. It also asks for my client_secret when I log back in for the first time. Also, each time I use client_secret, Bitwarden thinks I'm logging in from a new device (I get an email).

 

I still have one minor issue. If I log out via the workflow, then trigger the workflow again (either via shortcut or '.bw'), it no longer shows the 'logged out', 'log in' options, but the 'locked', 'unlock' ones instead. If I select those then unlock via password, I get notified that I'm not logged in, but don't get sent to a login field.

 

Basically, I can easily login in by going to '.bwauth', but the workflow isn't putting login options up front when I'm logged out.

 

Thanks for all your help here. Happy to send more logs if it helps.

 

So do I understand that you got the workflow partly working now?
One thing which doesn't really work yet easily is the usage of the bitwarden-cli in the terminal and in parallel the bitwarden workflow. that is because the session token will change each time an unlock happens and all the secrets are re-encrypted.

As a workaround you can use this script to share the same token between the cli and the workflow https://github.com/luckman212/bitwarden-cli-helpers

 

Thanks for mentioning the issue that after logout the wrong item is placed to unlock.. that will require a fix from my side.
 

Link to comment
3 minutes ago, blacs30 said:

So do I understand that you got the workflow partly working now?
One thing which doesn't really work yet easily is the usage of the bitwarden-cli in the terminal and in parallel the bitwarden workflow. that is because the session token will change each time an unlock happens and all the secrets are re-encrypted.

As a workaround you can use this script to share the same token between the cli and the workflow https://github.com/luckman212/bitwarden-cli-helpers

 

Thanks for mentioning the issue that after logout the wrong item is placed to unlock.. that will require a fix from my side.
 

 

Yes, it's working well now. Thanks!

 

I'm not sure how to use these scripts, but thanks for that too. I don't think the log in and out, session token thing will matter much, as I don't expect to be logging out very much.

 

Link to comment
  • 1 year later...
  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...