Class: Telnyx::Resources::OAuth
- Inherits:
-
Object
- Object
- Telnyx::Resources::OAuth
- Defined in:
- lib/telnyx/resources/oauth.rb
Instance Method Summary collapse
-
#grants(allowed:, consent_token:, request_options: {}) ⇒ Telnyx::Models::OAuthGrantsResponse
Create an OAuth authorization grant.
-
#initialize(client:) ⇒ OAuth
constructor
private
A new instance of OAuth.
-
#introspect(token:, request_options: {}) ⇒ Telnyx::Models::OAuthIntrospectResponse
Introspect an OAuth access token to check its validity and metadata.
-
#register(client_name: nil, grant_types: nil, logo_uri: nil, policy_uri: nil, redirect_uris: nil, response_types: nil, scope: nil, token_endpoint_auth_method: nil, tos_uri: nil, request_options: {}) ⇒ Telnyx::Models::OAuthRegisterResponse
Register a new OAuth client dynamically (RFC 7591).
-
#retrieve(consent_token, request_options: {}) ⇒ Telnyx::Models::OAuthRetrieveResponse
Retrieve details about an OAuth consent token.
-
#retrieve_authorize(client_id:, redirect_uri:, response_type:, code_challenge: nil, code_challenge_method: nil, scope: nil, state: nil, request_options: {}) ⇒ nil
OAuth 2.0 authorization endpoint for the authorization code flow.
-
#retrieve_jwks(request_options: {}) ⇒ Telnyx::Models::OAuthRetrieveJwksResponse
Retrieve the JSON Web Key Set for token verification.
-
#token(grant_type:, client_id: nil, client_secret: nil, code: nil, code_verifier: nil, redirect_uri: nil, refresh_token: nil, scope: nil, request_options: {}) ⇒ Telnyx::Models::OAuthTokenResponse
Exchange authorization code, client credentials, or refresh token for access token.
Constructor Details
#initialize(client:) ⇒ OAuth
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of OAuth.
205 206 207 |
# File 'lib/telnyx/resources/oauth.rb', line 205 def initialize(client:) @client = client end |
Instance Method Details
#grants(allowed:, consent_token:, request_options: {}) ⇒ Telnyx::Models::OAuthGrantsResponse
Create an OAuth authorization grant
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/telnyx/resources/oauth.rb', line 39 def grants(params) parsed, = Telnyx::OAuthGrantsParams.dump_request(params) @client.request( method: :post, path: "oauth/grants", body: parsed, model: Telnyx::Models::OAuthGrantsResponse, options: ) end |
#introspect(token:, request_options: {}) ⇒ Telnyx::Models::OAuthIntrospectResponse
Introspect an OAuth access token to check its validity and metadata
61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/telnyx/resources/oauth.rb', line 61 def introspect(params) parsed, = Telnyx::OAuthIntrospectParams.dump_request(params) @client.request( method: :post, path: "oauth/introspect", headers: {"content-type" => "application/x-www-form-urlencoded"}, body: parsed, model: Telnyx::Models::OAuthIntrospectResponse, options: ) end |
#register(client_name: nil, grant_types: nil, logo_uri: nil, policy_uri: nil, redirect_uris: nil, response_types: nil, scope: nil, token_endpoint_auth_method: nil, tos_uri: nil, request_options: {}) ⇒ Telnyx::Models::OAuthRegisterResponse
Register a new OAuth client dynamically (RFC 7591)
100 101 102 103 104 105 106 107 108 109 |
# File 'lib/telnyx/resources/oauth.rb', line 100 def register(params = {}) parsed, = Telnyx::OAuthRegisterParams.dump_request(params) @client.request( method: :post, path: "oauth/register", body: parsed, model: Telnyx::Models::OAuthRegisterResponse, options: ) end |
#retrieve(consent_token, request_options: {}) ⇒ Telnyx::Models::OAuthRetrieveResponse
Retrieve details about an OAuth consent token
17 18 19 20 21 22 23 24 |
# File 'lib/telnyx/resources/oauth.rb', line 17 def retrieve(, params = {}) @client.request( method: :get, path: ["oauth/consent/%1$s", ], model: Telnyx::Models::OAuthRetrieveResponse, options: params[:request_options] ) end |
#retrieve_authorize(client_id:, redirect_uri:, response_type:, code_challenge: nil, code_challenge_method: nil, scope: nil, state: nil, request_options: {}) ⇒ nil
OAuth 2.0 authorization endpoint for the authorization code flow
134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/telnyx/resources/oauth.rb', line 134 def (params) parsed, = Telnyx::OAuthRetrieveAuthorizeParams.dump_request(params) query = Telnyx::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "oauth/authorize", query: query, model: NilClass, options: ) end |
#retrieve_jwks(request_options: {}) ⇒ Telnyx::Models::OAuthRetrieveJwksResponse
Retrieve the JSON Web Key Set for token verification
155 156 157 158 159 160 161 162 |
# File 'lib/telnyx/resources/oauth.rb', line 155 def retrieve_jwks(params = {}) @client.request( method: :get, path: "oauth/jwks", model: Telnyx::Models::OAuthRetrieveJwksResponse, options: params[:request_options] ) end |
#token(grant_type:, client_id: nil, client_secret: nil, code: nil, code_verifier: nil, redirect_uri: nil, refresh_token: nil, scope: nil, request_options: {}) ⇒ Telnyx::Models::OAuthTokenResponse
Exchange authorization code, client credentials, or refresh token for access token
190 191 192 193 194 195 196 197 198 199 200 |
# File 'lib/telnyx/resources/oauth.rb', line 190 def token(params) parsed, = Telnyx::OAuthTokenParams.dump_request(params) @client.request( method: :post, path: "oauth/token", headers: {"content-type" => "application/x-www-form-urlencoded"}, body: parsed, model: Telnyx::Models::OAuthTokenResponse, options: ) end |