pdobsan / oama

OAuth credential Manager

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error "Can't find such service: microsoft" when commenting out google

ArthurBorsboom opened this issue · comments

Hi Peter,

After configuring config.yaml, I have noticed the following error (the same as yesterday).

user@desktop:~$ oama authorize microsoft user@domain.com
oama: Can't find such service: microsoft
CallStack (from HasCallStack):
  error, called at lib/OAMa/Authorization.hs:410:16 in oama-0.11.1-inplace:OAMa.Authorization

Since I am using only a microsoft service and not a google, I disabled google and enabled microsoft, like below.
However, this not working; I get the error above.

...
services:
  ##google:
  ##  client_id: application-CLIENT-ID
  ##  client_secret: application-CLIENT-SECRET
  ##  auth_scope: https://mail.google.com/

  microsoft:
     client_id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
     client_secret: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
     auth_scope: https://outlook.office365.com/IMAP.AccessAsUser.All
       https://outlook.office365.com/SMTP.Send
       offline_access
     tenant: common

When I do uncomment the unconfigured google service, then it does work.

...
services:
  google:
    client_id: application-CLIENT-ID
    client_secret: application-CLIENT-SECRET
    auth_scope: https://mail.google.com/

  microsoft:
     client_id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
     client_secret: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
     auth_scope: https://outlook.office365.com/IMAP.AccessAsUser.All
       https://outlook.office365.com/SMTP.Send
       offline_access
     tenant: common

I don't know if this is by design or a code issue.
If it is by design, then please close the ticket.

arthur@pb450:~$ oama printenv
###  Runtime environment  ###
config:
  encryption:
    contents: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    tag: GPG
  redirect_port: 8080
  services:
    microsoft:
      auth_endpoint: null
      auth_http_method: null
      auth_params_mode: null
      auth_scope: https://outlook.office365.com/IMAP.AccessAsUser.All https://outlook.office365.com/SMTP.Send
        offline_access
      client_id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
      client_secret: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
      tenant: common
      token_endpoint: null
      token_http_method: null
      token_params_mode: null
config_file: /home/arthur/.config/oama/config.yaml
data_dir: /home/arthur/.local/var/oama
oama_version: 0.11.1
op_sys: |
  Linux pb450 6.9.1-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 17 May 2024 16:56:38 +0000 x86_64 GNU/Linux
options:
  optCommand:
    tag: PrintEnv
  optConfig: ~/.config/oama/config.yaml
  optDebug: false
services:
  google:
    auth_endpoint: https://accounts.google.com/o/oauth2/auth
    auth_http_method: POST
    auth_params_mode: QueryString
    auth_scope: https://outlook.office365.com/IMAP.AccessAsUser.All https://outlook.office365.com/SMTP.Send
      offline_access
    client_id: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    client_secret: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    tenant: common
    token_endpoint: https://accounts.google.com/o/oauth2/token
    token_http_method: POST
    token_params_mode: RequestBody
######

release 0.12 should solve this.

Confirmed.

I don't see the error message anymore in v0.12.
Well done.

Closing issue.