Comments (4)
does this work?
fresh_token.set_refresh_token(Some(refresh_token));
I don't fully understand the but I can't access the refresh_token field
part of your question. The (old) refresh token is already in scope above in a variable called refresh_token
.
from oauth2-rs.
Thanks for the fast answer. This is my first project with rust.
No it does not work.
refresh_token fn give me a reference (&RefreshToken) but the set function want a RefreshToken.
Is it possible to access the string behind &RefreshToken ?
From the lib
pub fn refresh_token(&self) -> Option<&RefreshToken> {
self.refresh_token.as_ref()
}
pub fn set_refresh_token(&mut self, refresh_token: Option<RefreshToken>) {
self.refresh_token = refresh_token;
}
from oauth2-rs.
oh I see. I think what you want to do here is clone the refresh token since set_refresh_token()
needs an owned value. RefreshToken
implements Clone
, so you should just be able to do:
fresh_token.set_refresh_token(Some(refresh_token.clone()));
from oauth2-rs.
Thanks for your help
I reread rust doc about references and borrowing and just find it worked with to_owned()
fresh_token.set_refresh_token(Some(refresh_token.to_owned()));
from oauth2-rs.
Related Issues (20)
- "Device code expired" vs token_expired from endpoint timing issue HOT 5
- How to use extensions HOT 1
- How to inspect headers/error message on a failed refresh? HOT 5
- Token Revocation Device Code Work-Flow - Access token is empty reply HOT 2
- Re-export `reqwest`? HOT 1
- Cancelling the loop while polling for access token HOT 6
- User-customizable scope separators (feature request) HOT 4
- Comments in examples mention csrf_state which does not exist in the code HOT 1
- google example issues HOT 1
- Better error messages for failed requests HOT 3
- Support OAuth2 with JSON Web Token HOT 1
- Add User-Agent customization HOT 4
- Google example works but fails for async with Yew/Actix-Web HOT 2
- Compounding the sleep intervals if there is an error in the http_client HOT 3
- Github Device Code Flow does not work HOT 1
- microsoft_devicecode flow broken HOT 9
- How do I track state-pkce_verifier pairs for each authorization flow? HOT 2
- refresh_token is None using the tumblr api HOT 1
- Facebook scopes are None HOT 4
- Error: Failed to parse server response. On attempt to exchange token HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oauth2-rs.