Comments (4)
If
AccessToken
has to be reissued upon each request, what's the use of methods such asgetStoredAccessToken
or even the logic to refresh it?
We expect that getStoredAccessToken
is used for cache on your datastore.
I assumed that created AccessToken remains valid and is returned for all requests until it expires, so there is no need to reissue it until then.
So you can return cached access token from datastore until access token expires by getStoredAccessToken
. You just return None
on the method if you want to create new access token everytime.
I don't see how expiresIn can evaluate to false. It is eagerly evaluated in AccessToken constructor when createAccessToken is called,
By saving and getting the access token created time in the datastore, you should be able to specify lifeSeconds
and take expiresIn
to false.
I made a sample code before. I hope it help you. https://github.com/tsuyoshizawa/scala-oauth2-provider-example-skinny-orm/blob/master/app/controllers/OAuthController.scala
from scala-oauth2-provider.
We expect that AccessToken
use only one instance for one request coming.
The access token is created when user authorize via OAuth server first.
With the created access token, expiresIn
is evaluated when calling the API in a request, so that AccessToken#isExpired
can call true.
from scala-oauth2-provider.
If AccessToken
has to be reissued upon each request, what's the use of methods such as getStoredAccessToken
or even the logic to refresh it? Just send a new request and get a new token every time.
My understanding was different. I assumed that created AccessToken
remains valid and is returned for all requests until it expires, so there is no need to reissue it until then.
Also, I don't see how expiresIn
can evaluate to false. It is eagerly evaluated in AccessToken
constructor when createAccessToken
is called, and the only way it can be expired at the same moment is if you provide a negative lifeSeconds
which is not a valid use case anyway.
from scala-oauth2-provider.
you can return cached access token
But when you return this cached access token, it will have expiresIn
from the time it was first calculated, i.e. when it was created! That was my point. When I retrieve access token from cache, I expect to see actual time until expiration.
from scala-oauth2-provider.
Related Issues (20)
- Scala 2.12 support HOT 3
- Consider using scalafmt HOT 2
- value clientCredential is not a member HOT 2
- AccessToken never expires HOT 2
- Enhancing AuthInfo HOT 7
- Can no longer accept query string parameters HOT 1
- Not able to find out the Main method, web server start code, endpoints(routes) code HOT 1
- publish for Scala 3 HOT 1
- Disable all grant by default
- Authenticate Users Using Subdomains HOT 1
- [Question] Spray.io example ? HOT 1
- [Question] Java implementation HOT 1
- JSON error for OAuth2Provider.authorize HOT 1
- Should it be possible to have a ClientGrant without an AuthUser.info? HOT 3
- Unauthorized handling HOT 4
- Customize access to an authorized resource using Action Composition HOT 4
- Multiple DB requests HOT 1
- According to the RFC, client credential flow do not have to be linked to a user HOT 1
- akka-http-oauth2-provider miss a way to extend the AccessToken response HOT 1
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 scala-oauth2-provider.