:relfileprefix: ../../../
[#boost-urls-authority_view-password]

= xref:boost.adoc[pass:[boost]]::xref:boost/urls.adoc[pass:[urls]]::xref:boost/urls/authority_view.adoc[pass:[authority_view]]::password


Return the password


== Synopsis

Declared in header `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L580[boost/url/authority_view.hpp,window=blank_]>`

[source,cpp,subs="verbatim,macros,-callouts"]
----
template<class StringToken = xref:boost/urls/string_token.adoc[string_token]::xref:boost/urls/string_token/return_string.adoc[return_string]>
StringToken::result_type
password(StringToken&& token) const;
----

== Description


If present, this function returns a
string representing the password (which
may be an empty string).
Otherwise it returns an empty string.
Any percent-escapes in the string are
decoded first.

=== Example
[,cpp]
----
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).password() == "pass" );
----

=== Complexity

Linear in `this-&gt;password().size()`.

=== Exception Safety

Calls to allocate may throw.

=== BNF
[,cpp]
----
userinfo    = user [ ":" [ password ] ]

user        = *( unreserved / pct-encoded / sub-delims )
password    = *( unreserved / pct-encoded / sub-delims / ":" )
----

=== Specification

* link:https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1[3.2.1. User Information (rfc3986)]








== See Also


xref:boost/urls/authority_view/has_password.adoc[has_password]
,
xref:boost/urls/authority_view/has_userinfo.adoc[has_userinfo]
,
xref:boost/urls/authority_view/encoded_password.adoc[encoded_password]
,
xref:boost/urls/authority_view/encoded_user.adoc[encoded_user]
,
xref:boost/urls/authority_view/encoded_userinfo.adoc[encoded_userinfo]
,
xref:boost/urls/authority_view/user.adoc[user]
,
xref:boost/urls/authority_view/userinfo.adoc[userinfo]
.



