Module: Dnsimple::Client::Users
- Included in:
- UsersService
- Defined in:
- lib/dnsimple/client/users.rb
Instance Method Summary collapse
-
#exchange_token(otp_token, options = {}) ⇒ String
Requests a new two-factor authentication exchange token.
-
#user(options = {}) ⇒ Struct::User
Fetches the information about the authenticated user.
Instance Method Details
#exchange_token(otp_token, options = {}) ⇒ String
Requests a new two-factor authentication exchange token.
The exchange-token is required to validate API requests using HTTP Basic Authentication when the account has two-factor authentication enabled.
31 32 33 34 35 |
# File 'lib/dnsimple/client/users.rb', line 31 def exchange_token(otp_token, = {}) = Extra.deep_merge(, headers: { Client::HEADER_2FA_STRICT => "1", Client::HEADER_OTP_TOKEN => otp_token }) response = client.get(Client.versioned("/user"), ) response.headers[Client::HEADER_EXCHANGE_TOKEN] end |