Sha256: 8134dd09a2b254bec9bced9013dfbad6acb6b653de121cb95b9de7ee1d994b54
Contents?: true
Size: 1.01 KB
Versions: 13
Compression:
Stored size: 1.01 KB
Contents
# frozen_string_literal: true require "rodauth/oauth" module Rodauth Feature.define(:oauth_client_credentials_grant, :OauthClientCredentialsGrant) do depends :oauth_base def oauth_grant_types_supported super | %w[client_credentials] end private def create_token(grant_type) return super unless supported_grant_type?(grant_type, "client_credentials") grant_scopes = scopes grant_scopes = if grant_scopes redirect_response_error("invalid_scope") unless check_valid_scopes? grant_scopes.join(oauth_scope_separator) else oauth_application[oauth_applications_scopes_column] end grant_params = { oauth_grants_type_column => "client_credentials", oauth_grants_oauth_application_id_column => oauth_application[oauth_applications_id_column], oauth_grants_scopes_column => grant_scopes } generate_token(grant_params, false) end end end
Version data entries
13 entries across 13 versions & 1 rubygems