Skip to content

Commit 6fd95f9

Browse files
committed
Save tokens.
1 parent dd828fa commit 6fd95f9

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

oauth/src/main/java/ch/cyberduck/core/oauth/OAuth2AuthorizationService.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,29 +127,27 @@ public OAuthTokens validate(final OAuthTokens saved) throws BackgroundException
127127
if(saved.validate()) {
128128
// Found existing tokens
129129
if(saved.isExpired()) {
130-
log.warn("Refresh expired access tokens {}", saved);
131-
// Refresh expired access key
130+
log.warn("Refresh expired tokens {}", saved);
131+
// Refresh expired tokens
132132
try {
133133
final OAuthTokens refreshed = this.refresh(saved);
134134
log.debug("Refreshed tokens {} for {}", refreshed, host);
135-
credentials.setOauth(refreshed);
136-
return refreshed;
135+
return this.save(refreshed);
137136
}
138137
catch(LoginFailureException e) {
139138
log.warn("Failure refreshing tokens from {} for {}", saved, host);
140-
// Continue with new OAuth 2 flow
139+
// Continue with authorization flow
141140
}
142141
}
143142
else {
144-
log.debug("Returned saved OAuth tokens {} for {}", saved, host);
143+
log.debug("Returned saved tokens {} for {}", saved, host);
145144
return saved;
146145
}
147146
}
148-
log.warn("Missing OAuth tokens {} for {}", saved, host);
147+
log.warn("Missing tokens {} for {}", saved, host);
149148
final OAuthTokens tokens = this.authorize();
150149
log.debug("Retrieved tokens {} for {}", tokens, host);
151-
credentials.setOauth(tokens);
152-
return tokens;
150+
return this.save(tokens);
153151
}
154152

155153
/**

0 commit comments

Comments
 (0)