Skip to content

Commit 089cca6

Browse files
authored
Fix PayPal SSO OAuth callback (#4758)
* Maybe fix PayPal SSO * cargo sqlx prepare * maybe works * Attempt 2 of fixing * Fix vue * Try adding more logging to flow
1 parent 20484ed commit 089cca6

File tree

6 files changed

+220
-107
lines changed

6 files changed

+220
-107
lines changed

apps/frontend/src/components/ui/dashboard/withdraw-stages/LegacyPaypalDetailsStage.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,10 @@ const paypalEmail = computed(() => {
140140
141141
const paypalAuthUrl = computed(() => {
142142
const route = useRoute()
143+
const authToken = useCookie('auth-token')
143144
const separator = route.fullPath.includes('?') ? '&' : '?'
144145
const returnUrl = `${route.fullPath}${separator}paypal_auth_return=true`
145-
return getAuthUrl('paypal', returnUrl)
146+
return `${getAuthUrl('paypal', returnUrl)}&auth_token=${authToken.value}`
146147
})
147148
148149
function handlePayPalAuth() {

apps/labrinth/.sqlx/query-0d23c47e3f6803078016c4ae5d52c47b7a0d23ca747c753a5710b3eb3cf7c621.json

Lines changed: 0 additions & 17 deletions
This file was deleted.

apps/labrinth/.sqlx/query-77d39c54d5ca1622b53f029cb4c13edaed963e65d9e8fb9c58c116bba24fe2ac.json

Lines changed: 17 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/labrinth/src/auth/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ use thiserror::Error;
1818

1919
#[derive(Error, Debug)]
2020
pub enum AuthenticationError {
21+
#[error(transparent)]
22+
Internal(#[from] eyre::Report),
2123
#[error("Environment Error")]
2224
Env(#[from] dotenvy::Error),
2325
#[error("An unknown database error occurred: {0}")]
@@ -53,6 +55,9 @@ pub enum AuthenticationError {
5355
impl actix_web::ResponseError for AuthenticationError {
5456
fn status_code(&self) -> StatusCode {
5557
match self {
58+
AuthenticationError::Internal(..) => {
59+
StatusCode::INTERNAL_SERVER_ERROR
60+
}
5661
AuthenticationError::Env(..) => StatusCode::INTERNAL_SERVER_ERROR,
5762
AuthenticationError::Sqlx(..) => StatusCode::INTERNAL_SERVER_ERROR,
5863
AuthenticationError::Database(..) => {
@@ -87,6 +92,7 @@ impl actix_web::ResponseError for AuthenticationError {
8792
impl AuthenticationError {
8893
pub fn error_name(&self) -> &'static str {
8994
match self {
95+
AuthenticationError::Internal(..) => "internal_error",
9096
AuthenticationError::Env(..) => "environment_error",
9197
AuthenticationError::Sqlx(..) => "database_error",
9298
AuthenticationError::Database(..) => "database_error",

apps/labrinth/src/database/models/flow_item.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ pub enum DBFlow {
2020
user_id: Option<DBUserId>,
2121
url: String,
2222
provider: AuthProvider,
23+
existing_user_id: Option<DBUserId>,
2324
},
2425
Login2FA {
2526
user_id: DBUserId,

0 commit comments

Comments
 (0)