Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

easy refresh #160

Merged
merged 2 commits into from
Mar 9, 2025
Merged

easy refresh #160

merged 2 commits into from
Mar 9, 2025

Conversation

Emilgardis
Copy link
Member

resolves #158

@Emilgardis Emilgardis added the release mark pr as release label Mar 5, 2025
@Emilgardis Emilgardis force-pushed the easy-refresh branch 2 times, most recently from 7ed3d5c to ba2fc21 Compare March 5, 2025 15:55
@@ -150,6 +173,47 @@ impl UserToken {
.map_err(|e| e.into_other())
}

/// Create a [UserToken] from an existing active user token or refresh token if the access token is expired. Retrieves [`login`](TwitchToken::login), [`client_id`](TwitchToken::client_id) and [`scopes`](TwitchToken::scopes)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// Create a [UserToken] from an existing active user token or refresh token if the access token is expired. Retrieves [`login`](TwitchToken::login), [`client_id`](TwitchToken::client_id) and [`scopes`](TwitchToken::scopes)
/// Create a [UserToken] from an existing active user token or refresh token if the access token is expired. Retrieves [`login`](TwitchToken::login), [`client_id`](TwitchToken::client_id) and [`scopes`](TwitchToken::scopes).

@@ -112,9 +112,32 @@ impl UserToken {
Self::from_existing(http_client, access_token, None, None).await
}

/// Create a [UserToken] from a refresh token. Retrieves [`login`](TwitchToken::login), [`client_id`](TwitchToken::client_id) and [`scopes`](TwitchToken::scopes)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// Create a [UserToken] from a refresh token. Retrieves [`login`](TwitchToken::login), [`client_id`](TwitchToken::client_id) and [`scopes`](TwitchToken::scopes)
/// Create a [UserToken] from a refresh token. Retrieves [`login`](TwitchToken::login), [`client_id`](TwitchToken::client_id) and [`scopes`](TwitchToken::scopes).

I think this should mention that it refreshes the token. Afaik, the passed token doesn't become invalid, but it's better to save the new refresh token.

Copy link
Member Author

@Emilgardis Emilgardis Mar 5, 2025

Choose a reason for hiding this comment

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

Was considering adding it but then decided against it. But if you think it should be there I'll agree

@Emilgardis Emilgardis added this pull request to the merge queue Mar 9, 2025
Merged via the queue into main with commit f83de41 Mar 9, 2025
15 checks passed
@Emilgardis Emilgardis deleted the easy-refresh branch March 9, 2025 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release mark pr as release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add an easy way to retrieve a token given only the refresh token is valid
2 participants