Reference documentation and code samples for the googleauth module Google::Auth::ScopeUtil.
Small utility for normalizing scopes into canonical form.
The canonical form of scopes is as an array of strings, each in the form
of a full URL. This utility converts space-delimited scope strings into
this form, and handles a small number of common aliases.
This is used by UserRefreshCredentials to verify that a credential grants
a requested scope.
Methods
.as_array
defself.as_array(scope)->Array<String>
Ensure the input is an array. If a single string is passed in, splits
it via whitespace. Does not interpret aliases.
Parameter
scope(String, Array<String>) — Input scope(s)
Returns
(Array<String>) — Always an array of strings
Raises
(ArgumentError) — If the input is not a string or array of strings
.normalize
defself.normalize(scope)->Array<String>
Normalize the input, which may be an array of scopes or a whitespace-
delimited scope string. The output is always an array, even if a single
scope is input.
Parameter
scope(String, Array<String>) — Input scope(s)
Returns
(Array<String>) — An array of scopes in canonical form.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["# googleauth - Module Google::Auth::ScopeUtil (v1.15.0)\n\nVersion latestkeyboard_arrow_down\n\n- [1.15.0 (latest)](/ruby/docs/reference/googleauth/latest/Google-Auth-ScopeUtil)\n- [1.14.0](/ruby/docs/reference/googleauth/1.14.0/Google-Auth-ScopeUtil)\n- [1.13.1](/ruby/docs/reference/googleauth/1.13.1/Google-Auth-ScopeUtil)\n- [1.12.2](/ruby/docs/reference/googleauth/1.12.2/Google-Auth-ScopeUtil) \nReference documentation and code samples for the googleauth module Google::Auth::ScopeUtil.\n\nSmall utility for normalizing scopes into canonical form.\n\n\nThe canonical form of scopes is as an array of strings, each in the form\nof a full URL. This utility converts space-delimited scope strings into\nthis form, and handles a small number of common aliases.\n\n\u003cbr /\u003e\n\nThis is used by UserRefreshCredentials to verify that a credential grants\na requested scope.\n\nMethods\n-------\n\n### .as_array\n\n def self.as_array(scope) -\u003e Array\u003cString\u003e\n\nEnsure the input is an array. If a single string is passed in, splits\nit via whitespace. Does not interpret aliases. \n**Parameter**\n\n- **scope** (String, Array\\\u003cString\\\u003e) --- Input scope(s) \n**Returns**\n\n- (Array\\\u003cString\\\u003e) --- Always an array of strings \n**Raises**\n\n- (ArgumentError) --- If the input is not a string or array of strings\n\n### .normalize\n\n def self.normalize(scope) -\u003e Array\u003cString\u003e\n\nNormalize the input, which may be an array of scopes or a whitespace-\ndelimited scope string. The output is always an array, even if a single\nscope is input. \n**Parameter**\n\n- **scope** (String, Array\\\u003cString\\\u003e) --- Input scope(s) \n**Returns**\n\n- (Array\\\u003cString\\\u003e) --- An array of scopes in canonical form.\n\nConstants\n---------\n\n### ALIASES\n\n**value:** {\n\"email\" =\\\u003e \"[https://www.googleapis.com/auth/userinfo.email\"](https://www.googleapis.com/auth/userinfo.email");,\n\"profile\" =\\\u003e \"[https://www.googleapis.com/auth/userinfo.profile\"](https://www.googleapis.com/auth/userinfo.profile");,\n\"openid\" =\\\u003e \"[https://www.googleapis.com/auth/plus.me\"](https://www.googleapis.com/auth/plus.me");\n}.freeze \nAliases understood by this utility"]]