Skip to content

Commit

Permalink
[release/v1.0.0-rc1]: Manually apply open PR #1952: Decode identity c…
Browse files Browse the repository at this point in the history
…orrectly
  • Loading branch information
bfops committed Nov 6, 2024
1 parent e00ac50 commit 3a10733
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions crates/cli/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use base64::{
};
use reqwest::RequestBuilder;
use serde::Deserialize;
use spacetimedb::auth::identity::SpacetimeIdentityClaims2;
use spacetimedb::auth::identity::{IncomingClaims, SpacetimeIdentityClaims2};
use spacetimedb_client_api_messages::name::{DnsLookupResponse, RegisterTldResult, ReverseDNSResponse};
use spacetimedb_data_structures::map::HashMap;
use spacetimedb_lib::{AlgebraicType, Identity};
Expand Down Expand Up @@ -280,7 +280,8 @@ pub fn decode_identity(config: &Config) -> anyhow::Result<String> {
let decoded_bytes = BASE_64_STD_NO_PAD.decode(token_parts[1])?;
let decoded_string = String::from_utf8(decoded_bytes)?;

let claims_data: SpacetimeIdentityClaims2 = serde_json::from_str(decoded_string.as_str())?;
let claims_data: IncomingClaims = serde_json::from_str(decoded_string.as_str())?;
let claims_data: SpacetimeIdentityClaims2 = claims_data.try_into()?;

Ok(claims_data.identity.to_string())
}

0 comments on commit 3a10733

Please sign in to comment.