Struct ThirdPartyApp

Source
pub struct ThirdPartyApp {
Show 13 fields pub id: usize, pub created: usize, pub owner: usize, pub title: String, pub homepage: String, pub redirect: String, pub quota_status: AppQuota, pub banned: bool, pub grants: usize, pub scopes: Vec<AppScope>, pub api_key: String, pub data_used: usize, pub storage_capacity: DeveloperPassStorageQuota,
}
Expand description

An app is required to request grants on user accounts.

Users must approve grants through a web portal.

Fields§

§id: usize§created: usize§owner: usize

The ID of the owner of the app.

§title: String

The name of the app.

§homepage: String

The URL of the app’s homepage.

§redirect: String

The redirect URL for the app.

Upon accepting a grant request, the user will be redirected to this URL with a query parameter named token, which should be saved by the app for future authentication.

The developer dashboard lists the URL you should send users to in order to create a grant on their account in the information section under the label “Grant URL”.

Any search parameters sent with your grant URL (such as an internal user ID) will also be sent back when the user is redirected to your redirect URL.

You can use this behaviour to keep track of what user you should save the grant token under.

  1. Redirect user to grant URL with their ID: {grant_url}?my_app_user_id={id}
  2. In your redirect endpoint, read that ID and the added token parameter to store the token under the given my_app_user_id

The redirect URL will also have a verifier search parameter appended. This verifier is required to refresh the grant’s token (which is what is used in the Atto-Grant cookie).

Tokens only last a week after they were generated (with the verifier), but you can refresh them by sending a request to: {tetratto}/api/v1/auth/user/{user_id}/grants/{app_id}/refresh.

Tetratto will generate the verifier and challenge for you. The challenge is an SHA-256 hashed + base64 url encoded version of the verifier. This means if the verifier doesn’t match, it won’t pass the challenge.

Requests to API endpoints using your grant token should be sent with a cookie (in the Cookie or X-Cookie header) named Atto-Grant. This cookie should contain the token you received from either the initial connection, or a token refresh.

§quota_status: AppQuota

The app’s quota status, which determines how many grants the app is allowed to maintain.

§banned: bool

If the app is banned. A banned app cannot use any of its grants.

§grants: usize

The number of accepted grants the app maintains.

§scopes: Vec<AppScope>

The scopes used for every grant the app maintains.

These scopes are only cloned into new grants created for the app. An app cannot change scopes and have them affect users who already have the app connected. Users must delete the app’s grant and authenticate it again to update their scopes.

Your app should handle informing users when scopes change.

§api_key: String

The app’s secret API key (for app_data access).

§data_used: usize

The number of bytes the app’s app_data rows are using.

§storage_capacity: DeveloperPassStorageQuota

The app’s storage capacity.

Implementations§

Source§

impl ThirdPartyApp

Source

pub fn new( title: String, owner: usize, homepage: String, redirect: String, ) -> Self

Create a new ThirdPartyApp.

Trait Implementations§

Source§

impl Clone for ThirdPartyApp

Source§

fn clone(&self) -> ThirdPartyApp

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ThirdPartyApp

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ThirdPartyApp

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for ThirdPartyApp

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

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