lib/rodauth/features/oauth_base.rb in rodauth-oauth-0.9.3 vs lib/rodauth/features/oauth_base.rb in rodauth-oauth-0.10.0
- old
+ new
@@ -423,9 +423,14 @@
def generate_oauth_token(params = {}, should_generate_refresh_token = true)
create_params = {
oauth_tokens_expires_in_column => Sequel.date_add(Sequel::CURRENT_TIMESTAMP, seconds: oauth_token_expires_in)
}.merge(params)
+ if create_params[oauth_tokens_scopes_column].is_a?(Array)
+ create_params[oauth_tokens_scopes_column] =
+ create_params[oauth_tokens_scopes_column].join(" ")
+ end
+
rescue_from_uniqueness_error do
access_token = _generate_access_token(create_params)
refresh_token = _generate_refresh_token(create_params) if should_generate_refresh_token
oauth_token = _store_oauth_token(create_params)
oauth_token[oauth_tokens_token_column] = access_token