Skip to content

Conversation

@Sanket-Singhvi
Copy link

No description provided.

Comment on lines +106 to +117
let login = "http://localhost:3001/auth/sign-in"
.parse()
.expect("cannot find login url");

AppResponse::builder()
.body(OAuthAuthorizeResponse)
.headers(OAuthAuthorizeResponseHeaders {
redirect_url: login,
})
.status_code(StatusCode::FOUND)
.build()
.into_result()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assume the user is logged in. If the user is not logged in, throw an error. This request will be sent by the frontend. So the frontend will be responsible for taking care of login and what not


pub fn decode_token(token: &str, secret: &str) -> Result<AuthClaims, jsonwebtoken::errors::Error> {
info!("Decoding token: {}", token);
match decode::<AuthClaims>(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to manually take care of exp.

axum-typed-websockets = { workspace = true, features = ["default"] }
base32 = { workspace = true, features = [] }
base64 = { workspace = true, features = ["default"] }
chrono = { workspace = true, features = ["default", "serde"] }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No chrono. Use the time crate instead

pub client_id: String,
/// The redirect URI of the third-party app
#[serde(default, skip_serializing_if = "Option::is_none")]
#[serde(default, skip_serializing_if = "Option::is_none", rename = "redirect_uri")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're renaming to the same name?

pub scope: String,
/// The state of the request, if any
pub state: Option<String>,
#[serde(rename = "code_challenge")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

#[serde(rename = "code_challenge")]
/// The hashed value of a code challenge (as per PKCE)
pub code_challenge: String,
#[serde(rename = "code_challenge_method")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants