Skip to main contentModule token
Source use std::time::Duration; ๐ use axum::Json; ๐ use axum::body::Body; ๐ use axum::extract::Form; ๐ use axum::extract::State; ๐ use axum::response::IntoResponse; ๐ use http::Response; ๐ use http::StatusCode; ๐ use http::header::CACHE_CONTROL; ๐ use http::header::PRAGMA; ๐ use ruma::OwnedDeviceId; ๐ use ruma::UserId; ๐ use serde::Deserialize; ๐ use serde::Deserialize; ๐ use serde_json::json; ๐ use tuwunel_core::Err; ๐ use tuwunel_core::Error; ๐ use tuwunel_core::Result; ๐ use tuwunel_core::err; ๐ use tuwunel_core::info; ๐ use tuwunel_core::info; ๐ use tuwunel_core::utils::time::now; ๐ use tuwunel_core::warn; ๐ use tuwunel_service::Services; ๐ use tuwunel_service::oauth::server::DeviceGrantPoll; ๐ use tuwunel_service::oauth::server::IdTokenClaims; ๐ use tuwunel_service::oauth::server::Server; ๐ use tuwunel_service::oauth::server::narrow_scope; ๐ use tuwunel_service::users::device::generate_refresh_token; ๐ use super::oauth_error; ๐ use super::require_account_usable; ๐ use crate::ClientIp; ๐
- ApprovedGrant ๐
- An authenticated grant ready to mint tokens.
- TokenRequest ๐
- issue_tokens ๐
- Mint the access token, refresh token and device for an authenticated grant,
honoring the MSC2967 device scope and emitting the OAuth token response.
- token_authorization_code ๐
- token_device_code ๐
- RFC 8628 ยง3.4: poll the device-code grant; pending, denied and expired map
to the ยง3.5 error codes.
- token_error_response ๐
- RFC 6749 ยง5.2: map error to correct HTTP status and OAuth2 error code.
Client-side errors (invalid grant, bad params) โ 400 invalid_grant.
Server-side errors โ 500 server_error with sanitized message.
- token_refresh ๐
- token_refresh_response ๐
- token_route ๐