Commit
According the google authenticator docs the issuer should be included both in the URL itself as well as in the query string. See: https://github.com/google/google-authenticator/wiki/Key-Uri-Format#issuer
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,9 +51,14 @@ def verify_with_drift(otp, drift, time = Time.now) | |
# This can then be encoded in a QR Code and used | ||
# to provision the Google Authenticator app | ||
# @param [String] name of the account | ||
# @return [String] provisioning uri | ||
# @return [String] provisioning URI | ||
def provisioning_uri(name) | ||
encode_params("otpauth://totp/#{URI.encode(name)}", | ||
# The format of this URI is documented at: | ||
# https://github.com/google/google-authenticator/wiki/Key-Uri-Format | ||
# For compatibility the issuer appears both before that account name and also in the | ||
# query string. | ||
issuer_string = issuer.nil? ? "" : "#{URI.encode(issuer)}:" | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
sbc100
Author
Contributor
|
||
encode_params("otpauth://totp/#{issuer_string}#{URI.encode(name)}", | ||
:secret => secret, :period => (interval==30 ? nil : interval), :issuer => issuer) | ||
end | ||
|
||
|
This looks much better with an ending space. Can we add one? I guess
%20
directly since it's not going to be encoded.