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: usizeThe ID of the owner of the app.
title: StringThe name of the app.
homepage: StringThe URL of the app’s homepage.
redirect: StringThe 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.
- Redirect user to grant URL with their ID:
{grant_url}?my_app_user_id={id} - In your redirect endpoint, read that ID and the added
tokenparameter to store thetokenunder the givenmy_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: AppQuotaThe app’s quota status, which determines how many grants the app is allowed to maintain.
banned: boolIf the app is banned. A banned app cannot use any of its grants.
grants: usizeThe 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: StringThe app’s secret API key (for app_data access).
data_used: usizeThe number of bytes the app’s app_data rows are using.
storage_capacity: DeveloperPassStorageQuotaThe app’s storage capacity.
Implementations§
Source§impl ThirdPartyApp
impl ThirdPartyApp
Trait Implementations§
Source§impl Clone for ThirdPartyApp
impl Clone for ThirdPartyApp
Source§fn clone(&self) -> ThirdPartyApp
fn clone(&self) -> ThirdPartyApp
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more