From 2530e8f08c3f3db9ccc1cfd7846a2d5d105daea0 Mon Sep 17 00:00:00 2001
From: Emilie Balland <ebrauner@sensational.ch>
Date: Fri, 14 Sep 2018 14:46:28 +0200
Subject: [PATCH] never delete refresh token when refreshing

Otherwise this may cause any error or loss of connectivity leading to
refresh token deletion. There is a pending PR on the main repo
https://github.com/p2/OAuth2/pull/281

Related to sensational/popscan-android#977
---
 Sources/Flows/OAuth2.swift | 1 -
 1 file changed, 1 deletion(-)

diff --git a/Sources/Flows/OAuth2.swift b/Sources/Flows/OAuth2.swift
index 70702664..025ae988 100644
--- a/Sources/Flows/OAuth2.swift
+++ b/Sources/Flows/OAuth2.swift
@@ -367,7 +367,6 @@ open class OAuth2: OAuth2Base {
 					let data = try response.responseData()
 					let json = try self.parseRefreshTokenResponseData(data)
 					if response.response.statusCode >= 400 {
-						self.clientConfig.refreshToken = nil
 						throw OAuth2Error.generic("Failed with status \(response.response.statusCode)")
 					}
 					self.logger?.debug("OAuth2", msg: "Did use refresh token for access token [\(nil != self.clientConfig.accessToken)]")