Struct AuthorizeUrlBuilder

Source
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>

Source

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.

Source

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.

Source

pub fn force_reauthentication(self, value: bool) -> Self

Set whether the user should have to re-login when approving the request.

Source

pub fn disable_signup(self, value: bool) -> Self

Set whether new user signups should be allowed or not while approving the request.

Source

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.

Source

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).

Source

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.

Source

pub fn locale(self, value: &'a str) -> Self

Force a specific locale when prompting the user, instead of the locale indicated by their browser.

Source

pub fn token_type(self, value: TokenType) -> Self

What type of token should be requested. Defaults to TokenType::ShortLivedAndRefresh.

Source

pub fn scope(self, value: &'a str) -> Self

This parameter allows your user to authorize a subset of the scopes selected in the App Console. Multiple scopes are separated by a space. If this parameter is omitted, the authorization page will request all scopes selected on the Permissions tab.

Source

pub fn build(self) -> Url

Build the OAuth2 authorization URL from the previously given parameters.

Trait Implementations§

Source§

impl<'a> Debug for AuthorizeUrlBuilder<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,