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

Add mechanism to refresh the token #5930

Closed
czerwonkabartosz opened this issue Oct 19, 2017 · 1 comment
Closed

Add mechanism to refresh the token #5930

czerwonkabartosz opened this issue Oct 19, 2017 · 1 comment

Comments

@czerwonkabartosz
Copy link

Now the token is valid for 24 hours, so if the user is on the site for more than 24 hours and then sends a request the server will reject the request because of a invalid token.

The best option is to create a TokenManager (name to rethinking) in https://github.com/ckeditor/ckeditor-cloudservices-core that will download new token every X time from URL.

Pseudocode:

class TokenManager {
	constructor( tokenUrl, time = 3600 ) {
		// ... emit event if new token received
	}
}

class UploadGateway {
	constructor( tokenManager ) {
		tokenManager.on( 'changed:token', () => {
			// ....
		} );
	}
}

const tokenManager = new TokenManager( 'url' );
const uploadGateway = new UploadGateway( tokenManager );
@czerwonkabartosz czerwonkabartosz self-assigned this Oct 19, 2017
@czerwonkabartosz
Copy link
Author

As @pjasiun mentioned, we TokenManager should be called Token.

I would call it just Token:

const token = new Token( 'url' );
const uploadGateway = new UploadGateway( token );
token.value // the value of the token, also `change:value`, but note that it will be used only internally, for the external user it will be just a `token`.

czerwonkabartosz referenced this issue in ckeditor/ckeditor-cloud-services-core Oct 24, 2017
Feature: Added mechanism to refresh the token. Closes #4.
@mlewand mlewand transferred this issue from ckeditor/ckeditor-cloud-services-core Dec 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants