You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I generate manually both the token and access token to access the Gmail API.
Therefore, I want to use the AccessTokenAuthenticator, but I see it only accepts an access_token string, then I understand that there is no internal logic that will refresh the token automatically once the token expires:(
Is there a way I can take advantage of the refresh token that I have so the token gets internally refreshed?
Here is my code
let authenticator = oauth2::authenticator::AccessTokenAuthenticator::builder(// It would be nice to pass the refresh token in hereself.access_token.token().to_owned(),).build().await.map_err(AuthError::AuthenticatorBuilderError)?;letmut hub = Gmail::new(
hyper::Client::builder().build(
hyper_rustls::HttpsConnectorBuilder::new().with_native_roots().https_or_http().enable_http1().enable_http2().build(),),
authenticator,);
The text was updated successfully, but these errors were encountered:
It would be also nice to be able to read the tokens directly from a file and do something like
// Get an ApplicationSecret instance by some means. It contains the `client_id` and // `client_secret`, among other things.let token_info:TokenInfo = oauth2::read_token_from("/path/to/file");let authenticator = oauth2::authenticator::AccessTokenAuthenticator::builder(
token_info
).persist_tokens_on_disk("path/to/file").build().await.map_err(AuthError::AuthenticatorBuilderError)?;
Hi!
I have the following use case:
I generate manually both the token and access token to access the Gmail API.
Therefore, I want to use the
AccessTokenAuthenticator
, but I see it only accepts anaccess_token
string, then I understand that there is no internal logic that will refresh the token automatically once the token expires:(Is there a way I can take advantage of the refresh token that I have so the token gets internally refreshed?
Here is my code
The text was updated successfully, but these errors were encountered: