Class: ThePlaidApi::OauthSubjectTokenType

Inherits:
Object
  • Object
show all
Defined in:
lib/the_plaid_api/models/oauth_subject_token_type.rb

Overview

The type of the subject token. ‘urn:plaid:params:tokens:user` allows exchanging a Plaid-issued user token for an OAuth token. When using this token type, `audience` must be the same as the `client_id`. `subject_token` must be a Plaid-issued user token issued from the `/user/create` endpoint. `urn:plaid:params:oauth:user-token` allows exchanging a refresh token for an OAuth token to another `client_id`. The other `client_id` is provided in `audience`. `subject_token` must be an OAuth refresh token issued from the `/oauth/token` endpoint. `urn:plaid:params:credit:multi-user` allows exchanging a Plaid-issued user token for an OAuth token. When using this token type, `audience` may be a client id or a supported CRA partner URN. `audience` supports a comma-delimited list of clients. When multiple clients are specified in the `audience` a multi-party token is created which can be used by all parties in the audience in conjunction with their `client_id` and `client_secret`.

Constant Summary collapse

OAUTH_SUBJECT_TOKEN_TYPE =
[
  # TODO: Write general description for ENUM_URNPLAIDPARAMSTOKENSUSER
  ENUM_URNPLAIDPARAMSTOKENSUSER = 'urn:plaid:params:tokens:user'.freeze,

  # TODO: Write general description for ENUM_URNPLAIDPARAMS_OAUTH_USERTOKEN
  ENUM_URNPLAIDPARAMS_OAUTH_USERTOKEN = 'urn:plaid:params:oauth:user-token'.freeze,

  # TODO: Write general description for ENUM_URNPLAIDPARAMSCREDITMULTIUSER
  ENUM_URNPLAIDPARAMSCREDITMULTIUSER = 'urn:plaid:params:credit:multi-user'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = ENUM_URNPLAIDPARAMSTOKENSUSER) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/the_plaid_api/models/oauth_subject_token_type.rb', line 39

def self.from_value(value, default_value = ENUM_URNPLAIDPARAMSTOKENSUSER)
  return default_value if value.nil?

  str = value.to_s.strip

  case str.downcase
  when 'enum_urnplaidparamstokensuser' then ENUM_URNPLAIDPARAMSTOKENSUSER
  when 'enum_urnplaidparams_oauth_usertoken' then ENUM_URNPLAIDPARAMS_OAUTH_USERTOKEN
  when 'enum_urnplaidparamscreditmultiuser' then ENUM_URNPLAIDPARAMSCREDITMULTIUSER
  else
    default_value
  end
end

.validate(value) ⇒ Object



33
34
35
36
37
# File 'lib/the_plaid_api/models/oauth_subject_token_type.rb', line 33

def self.validate(value)
  return false if value.nil?

  OAUTH_SUBJECT_TOKEN_TYPE.include?(value)
end