Skip to content

Commit 34de0bf

Browse files
committed
cleanup
1 parent 1431a45 commit 34de0bf

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

src/tokens/app_access_token.rs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -141,13 +141,14 @@ impl AppAccessToken {
141141
client_id: impl Into<ClientId>,
142142
client_secret: impl Into<ClientSecret>,
143143
) -> AppAccessToken {
144+
let expires_in = response.expires_in();
144145
AppAccessToken::from_existing_unchecked(
145146
response.access_token,
146147
response.refresh_token,
147148
client_id.into(),
148149
client_secret,
149150
response.scopes,
150-
response.expires_in.map(std::time::Duration::from_secs),
151+
expires_in,
151152
)
152153
}
153154

@@ -170,15 +171,7 @@ impl AppAccessToken {
170171
.map_err(AppAccessTokenError::Request)?;
171172

172173
let response = crate::id::TwitchTokenResponse::from_response(&resp)?;
173-
let expires_in = response.expires_in();
174-
let app_access = AppAccessToken::from_existing_unchecked(
175-
response.access_token,
176-
response.refresh_token,
177-
client_id,
178-
client_secret,
179-
response.scopes,
180-
expires_in,
181-
);
174+
let app_access = AppAccessToken::from_response(response, client_id, client_secret);
182175

183176
Ok(app_access)
184177
}

0 commit comments

Comments
 (0)