pub struct AuthorizeUrlBuilder<'a> { /* private fields */ }
Expand description
Builds a URL that can be given to the user to visit to have Dropbox authorize your app.
If this app is a server-side app, you should redirect the user’s browser to this URL to begin the authorization, and set the redirect_uri to bring the user back to your site when done.
If this app is a client-side app, you should open a web browser with this URL to begin the authorization, and set the redirect_uri to bring the user back to your app.
As a special case, if your app is a command-line application, you can skip setting the redirect_uri and print this URL and instruct the user to open it in a browser. When they complete the authorization, they will be given an auth code to input back into your app.
If you are using the deprecated Implicit Grant flow, the redirect after authentication will
provide you an OAuth2 token. In all other cases, you will have an authorization code, and you
must call make another call to obtain a token. See Authorization
, which is used to do this.
Implementations§
Source§impl<'a> AuthorizeUrlBuilder<'a>
impl<'a> AuthorizeUrlBuilder<'a>
Sourcepub fn new(client_id: &'a str, flow_type: &'a Oauth2Type) -> Self
pub fn new(client_id: &'a str, flow_type: &'a Oauth2Type) -> Self
Return a new builder for the given client ID and auth flow type, with all fields set to defaults.
Sourcepub fn force_reapprove(self, value: bool) -> Self
pub fn force_reapprove(self, value: bool) -> Self
Set whether the user should be prompted to approve the request regardless of whether they have approved it before.
Sourcepub fn force_reauthentication(self, value: bool) -> Self
pub fn force_reauthentication(self, value: bool) -> Self
Set whether the user should have to re-login when approving the request.
Sourcepub fn disable_signup(self, value: bool) -> Self
pub fn disable_signup(self, value: bool) -> Self
Set whether new user signups should be allowed or not while approving the request.
Sourcepub fn redirect_uri(self, value: &'a str) -> Self
pub fn redirect_uri(self, value: &'a str) -> Self
Set the URI the approve request should redirect the user to when completed. If no redirect URI is specified, the user will be shown the code directly and will have to manually input it into your app.
Sourcepub fn state(self, value: &'a str) -> Self
pub fn state(self, value: &'a str) -> Self
Up to 500 bytes of arbitrary data that will be passed back to your redirect URI. This parameter should be used to protect against cross-site request forgery (CSRF).
Sourcepub fn require_role(self, value: &'a str) -> Self
pub fn require_role(self, value: &'a str) -> Self
If this parameter is specified, the user will be asked to authorize with a particular type
of Dropbox account, either work
for a team account or personal
for a personal account.
Your app should still verify the type of Dropbox account after authorization since the user
could modify or remove the require_role parameter.
Sourcepub fn locale(self, value: &'a str) -> Self
pub fn locale(self, value: &'a str) -> Self
Force a specific locale when prompting the user, instead of the locale indicated by their browser.
Sourcepub fn token_type(self, value: TokenType) -> Self
pub fn token_type(self, value: TokenType) -> Self
What type of token should be requested. Defaults to TokenType::ShortLivedAndRefresh
.