rfesi icon indicating copy to clipboard operation
rfesi copied to clipboard

Error when trying to authenticate user using .enable_application_authentication(true) with Builder

Open rafaga opened this issue 1 year ago • 3 comments

when I execute let claims_option = self.esi.authenticate(oauth_data.0.as_str(), verifier).await?;

rfesi throws a HTTP 400 when running

let resp = self
    .client
    .post(&self.token_url)
    .headers(self.get_auth_headers()?)
    .form(&body)
    .send()
    .await?;

this is client.rs line 328-334 from rfesi

anmd on Terminal this message appears

024-04-23 20:50:04.782199-0600 Application[10289:39096] [miscellany] CLIENT ERROR: TUINSRemoteViewController does not override -viewServiceDidTerminateWithError: and thus cannot react to catastrophic errors beyond logging them

Any ideas what could be? It works when I'm not using .enable_application_authentication(true) in Builder

rafaga avatar Apr 24 '24 02:04 rafaga

Hey sorry, haven't looked yet but will do so soon.

On Tue, Apr 23, 2024, at 7:59 PM, Rafael wrote:

when I execute let claims_option = self.esi.authenticate(oauth_data.0.as_str(), verifier).await?;

rfesi throws a HTTP 400 when running

let resp = self .client .post(&self.token_url) .headers(self.get_auth_headers()?) .form(&body) .send() .await?; this is client.rs line 328-334 from rfesi

anmd on Terminal this message appears

024-04-23 20:50:04.782199-0600 Application[10289:39096] [miscellany] CLIENT ERROR: TUINSRemoteViewController does not override -viewServiceDidTerminateWithError: and thus cannot react to catastrophic errors beyond logging them

Any ideas what could be? It works when I'm not using .enable_application_authentication(true) in Builder

— Reply to this email directly, view it on GitHub https://github.com/Celeo/rfesi/issues/41, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAF4TGZZBKAMEZIDG5OCEH3Y64NZ3AVCNFSM6AAAAABGWB5IVKVHI2DSMVQWIX3LMV43ASLTON2WKOZSGI3DAMJZGM4DEMQ. You are receiving this because you are subscribed to this thread.Message ID: @.***>

Celeo avatar Apr 24 '24 22:04 Celeo

Hmm, very odd. I was able to create a new application on the Eve devs site and do this:

    let mut esi = rfesi::prelude::EsiBuilder::new()
        .user_agent("github.com/celeo/rfesi")
        .client_id("abc...")
        .callback_url("http://localhost:5000/sso/callback")
        .enable_application_authentication(true)
        .build()
        .unwrap();
    let auth_url = esi.get_authorize_url().unwrap();
    info!("Auth url: {}", auth_url.authorization_url);
    debug!("PKCE: {}", auth_url.pkce_verifier.unwrap());
}

then access the URL, grab the code from the URL, and put it in:

    let mut esi = rfesi::prelude::EsiBuilder::new()
        .user_agent("github.com/celeo/rfesi")
        .client_id("abc...")
        .callback_url("http://localhost:5000/sso/callback")
        .enable_application_authentication(true)
        .build()
        .unwrap();
    let claims = esi
        .authenticate(
            "code_from_url",
            Some("verification_from_before".to_string()),
        )
        .await
        .unwrap();
    dbg!(claims);

and got:

[src/main.rs:27:5] claims = Some(
    TokenClaims {
        aud: [
            "...",
            "EVE Online",
        ],
        azp: "...",
        exp: ...,
        iat: ...,
        iss: "https://login.eveonline.com",
        jti: "...",
        kid: "JWT-Signature-Key",
        name: "Celeo Servasse",
        owner: "abc...",
        region: "world",
        scp: None,
        sub: "CHARACTER:EVE:91316135",
        tenant: "tranquility",
        tier: "live",
    },
)

Celeo avatar Apr 26 '24 02:04 Celeo

Let me check my code its probably error on my side

rafaga avatar Apr 26 '24 21:04 rafaga

I'll close because I haven't so much time to verify this, I'll resume this when I have finished some tasks in my application. fo

rafaga avatar Jun 12 '24 16:06 rafaga