toScopeParameter
Computes the scope parameter from an array of scopes.
Behavior:
If {@code scopes} is null or empty, returns an empty string. This indicates that all scopes assigned to the connected app / external client app will be requested by default (no explicit scope parameter is sent).
If {@code scopes} is non-empty, ensures {@code refresh_token} is present in the set and returns a space-delimited string of unique, sorted scopes.