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

First functionality for refresh tokens (Android + iOS) #60

Merged
merged 7 commits into from
Jan 9, 2020
Merged

First functionality for refresh tokens (Android + iOS) #60

merged 7 commits into from
Jan 9, 2020

Conversation

dennisameling
Copy link
Contributor

First commit for #59

call.reject(ERR_GENERAL, ex);
} else {
if (response1 != null) {
if (oauth2Options.getResourceUrl() != null) {
Copy link
Contributor Author

@dennisameling dennisameling Nov 24, 2019

Choose a reason for hiding this comment

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

I guess this part (resourceUrl) is not needed for just refreshing a token, right?

@@ -245,28 +312,28 @@ protected void handleOnActivityResult(int requestCode, int resultCode, Intent da
try {
tokenExchangeRequest = response.createTokenExchangeRequest();
this.authService.performTokenRequest(tokenExchangeRequest, (response1, ex) -> {
authState.update(response1, ex);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just formatting here, no code changes

@moberwasserlechner moberwasserlechner added this to the 1.1.0 milestone Nov 26, 2019
When leaving the app idle for 1 hour (token expiry time), the authState becomes null (as it's only set in the authenticate method). Added some code to set the authState in case it's empty (just like in the authenticate method).
@dennisameling dennisameling changed the title First functionality for refresh tokens (Android only) First functionality for refresh tokens (Android + iOS) Nov 26, 2019
@moberwasserlechner
Copy link
Collaborator

@dennisameling Are you finished with this.

I don't know when I have the time to review and test it but I can add it to my todo list ;)

@dennisameling
Copy link
Contributor Author

@moberwasserlechner sorry for the late reply! Android + iOS are done, we've started using those in a production application (~100 users) last week and it's been working flawlessly. 👍 I just removed the PWA code, as it was incomplete. If we were to use the implicit flow for refreshing tokens, it would involve creating an iFrame to refresh the token without user interaction. The angular-oauth2-oidc library also uses iFrames for refreshing tokens, so we could take inspiration from that. Let's discuss the ideas/strategy for PWA further in #59 😃, then this PR would just be for Android + iOS.

@moberwasserlechner moberwasserlechner merged commit 39bed67 into capacitor-community:master Jan 9, 2020
@moberwasserlechner
Copy link
Collaborator

Thx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants