Back

[SOLVED] Proper CLI command to enable google/apple oauth

  • 1
  • General
  • Tools
squallsama
26 Mar, 2023, 06:58

Hello ! I'm trying to utilize appwrite cli on ci server, but can't find proper command related to enabling oAuth provides.

I tried couple: appwrite projects updateAuthStatus --projectId projectId --method google --status true βœ— Error Invalid method: Value must be one of (email-password, magic-url, anonymous, invites, jwt, phone)

appwrite projects updateOAuth2 --projectId projectId --provider google --appId appId --secret secret --enabled true error: unknown option '--enabled'

Could someone help with a proper command ? Help (-h) flag doesn't provide info about how to enable oAuth for google/apple appwrite projects updateAuthStatus --projectId projectId -h - looks like only supports email-password,magic-url,anonymous,invites,jwt,phone

TypeScript
Usage: index projects updateAuthStatus [options]

Options:
  --projectId <projectId>  Project unique ID.
  --method <method>        Auth Method. Possible values: email-password,magic-url,anonymous,invites,jwt,phone
  --status <status>        Set the status of this auth method.
  -h, --help               display help for command
TypeScript
Usage: index projects updateOAuth2 [options]

Options:
  --projectId <projectId>  Project unique ID.
  --provider <provider>    Provider Name
  --appId <appId>          Provider app ID. Max length: 256 chars.
  --secret <secret>        Provider secret key. Max length: 512 chars.
  -h, --help               display help for command
TL;DR
The user is trying to enable OAuth providers (Google/Apple) using the Appwrite CLI. They have tried different commands but haven't found the correct one. The CLI version they were using doesn't support the `--enabled` flag. The current solution is to use the `--enabled true` flag with the `updateOAuth2` command using version 1.2.1 of the CLI. Upgrading to the latest version of the CLI may also solve the issue.
Vedsaga
26 Mar, 2023, 06:59

I guess the best and fastest and easiest way is to do it vai console

squallsama
26 Mar, 2023, 06:59

Yeah, but I want to set-up instance via ci or some orch like ansible or chef

Vedsaga
26 Mar, 2023, 07:00

mm, pretty valid point and would later for sure will come handy

Vedsaga
26 Mar, 2023, 07:01

I guess did you tried enabling one by one? can see apple and google both seems to be there

squallsama
26 Mar, 2023, 07:02

I can't enable them by cli, because list of argument limited to email-password,magic-url,anonymous,invites,jwt,phone

squallsama
26 Mar, 2023, 07:03

I can do something like - appwrite projects updateAuthStatus --projectId projectId --method jwt --status false

squallsama
26 Mar, 2023, 07:03

but not anything related to enablind oAuth providers via cli. I can set-up them with secrets and appId, but not enable them...this looks really weird to me

squallsama
26 Mar, 2023, 07:05

updateOAuth2 also doesn't support anything related to enabling provider

TypeScript
Usage: projects updateOAuth2 [options]


Options:
  --projectId <projectId>  Project unique ID.
  --provider <provider>    Provider Name
  --appId <appId>          Provider app ID. Max length: 256 chars.
  --secret <secret>        Provider secret key. Max length: 512 chars.
  -h, --help               display help for command
Vedsaga
26 Mar, 2023, 07:06

mm, may be might be wrong, but it seems I guess we can only set the ids only... to enable & disable have to be done via Console itself

squallsama
26 Mar, 2023, 07:07

I remember that @Steven said that everything we can do via console we should be able to do via cli too

squallsama
26 Mar, 2023, 07:10

yeah, looks like console uses payload with enabled field, but cli doesn't support such option 😦

Vedsaga
26 Mar, 2023, 07:13

mm 😦 I guess, this can new feature request

squallsama
26 Mar, 2023, 07:18

looks like it should support

squallsama
26 Mar, 2023, 07:23

looks like update to latest version of cli was needed...sorry πŸ™‚

Vedsaga
26 Mar, 2023, 07:23

ahh no worries, it's great you found the way

squallsama
26 Mar, 2023, 07:23

--enabled true in updateOAuth2 using 1.2.1 version of cli works fine

Drake
26 Mar, 2023, 15:49

[SOLVED] Proper CLI command to enable google/apple oauth

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more