Specify scopes for oauth in text file

15 views
Skip to first unread message

Drew Boone

unread,
Oct 29, 2025, 5:55:24 PM (9 days ago) Oct 29
to GAM for Google Workspace
Is it possible to specify the scopes to be used the oauth create command in a text file? I've tried the following but I get a syntax error.

gam oauth create scopes scopes.txt

Organizational policy requires that we delete oauth after each session and that we use limited scopes, but the process of selecting scopes each time I reauthorize is a bit of a pain.

NOTICE: This email and any attachments may contain confidential and proprietary information of The Daston Corporation and is for the sole use of the intended recipient for the stated purpose. Any improper use or distribution is prohibited. If you are not the intended recipient, please notify the sender; do not review, copy or distribute; and promptly delete or destroy all transmitted information. Please note that all communications and information transmitted through this email system may be monitored and retained by Daston or its agents and that all incoming email is automatically scanned by a third party spam and filtering service which may result in deletion of a legitimate e-mail before it is read by the intended recipient.

Ross Scroggs

unread,
Oct 29, 2025, 6:35:54 PM (9 days ago) Oct 29
to google-ap...@googlegroups.com
See: https://github.com/GAM-team/GAM/wiki/Authorization#create-client-credentials

You could have a variable that contains the list of scopes and then do:
gam oauth create admin <EmailAddress> scopes "$scopes"

Ross
----
Ross Scroggs



--
You received this message because you are subscribed to the Google Groups "GAM for Google Workspace" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-man...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/google-apps-manager/4f47b6db-68e4-4f5b-92de-4d6cefd5d3d5n%40googlegroups.com.

Drew Boone

unread,
Oct 29, 2025, 6:59:26 PM (9 days ago) Oct 29
to GAM for Google Workspace
I figured that might be the case, but I was hopeful for some other kind of magic. Thanks for your help, Ross.

Jay Lee

unread,
Oct 29, 2025, 7:19:10 PM (9 days ago) Oct 29
to google-ap...@googlegroups.com
gam oauth create admin <EmailAddress> scopes "$(cat scopes.txt)"

assuming you're using a decent shell like Bash. I'm sure Powershell has some equivalent capability that's 5x as many characters in length though :-)

Jay Lee


Drew Boone

unread,
Oct 29, 2025, 7:27:54 PM (9 days ago) Oct 29
to GAM for Google Workspace
LOL, I like that even better, Jay.
Reply all
Reply to author
Forward
0 new messages