@@ -143,6 +143,7 @@ public class OAuth2 {
143143 private static final String ASSERTION = "assertion" ;
144144 private static final String JWT_BEARER = "urn:ietf:params:oauth:grant-type:jwt-bearer" ;
145145 protected static final String OAUTH_AUTH_PATH = "/services/oauth2/authorize" ;
146+ private static final String REVOKE_REASON = "revoke_reason" ;
146147
147148 /** Endpoint path for Salesforce Identity API initialize headless, password-less login flow */
148149 protected static String OAUTH_ENDPOINT_HEADLESS_INIT_PASSWORDLESS_LOGIN = "/services/auth/headless/init/passwordless/login" ;
@@ -155,7 +156,7 @@ public class OAuth2 {
155156
156157 private static final String OAUTH_DISPLAY_PARAM = "?display=" ;
157158 protected static final String OAUTH_TOKEN_PATH = "/services/oauth2/token" ;
158- private static final String OAUTH_REVOKE_PATH = "/services/oauth2/revoke?token=%s&revoke_reason=%s " ;
159+ private static final String OAUTH_REVOKE_PATH = "/services/oauth2/revoke" ;
159160 private static final String LIGHTNING_DOMAIN = "lightning_domain" ;
160161 private static final String LIGHTNING_SID = "lightning_sid" ;
161162 private static final String VF_DOMAIN = "visualforce_domain" ;
@@ -470,15 +471,23 @@ public static TokenEndpointResponse refreshAuthToken(HttpAccess httpAccessor, UR
470471 * @param reason The reason the refresh token is being revoked.
471472 */
472473 public static void revokeRefreshToken (HttpAccess httpAccessor , URI loginServer , String refreshToken , LogoutReason reason ) {
473- final String requestPath = String .format (OAUTH_REVOKE_PATH , refreshToken , reason .toString ());
474- final Request request = new Request .Builder ().url (loginServer .toString () + requestPath ).get ().build ();
474+ final Request request = buildRevokeRefreshTokenRequest (loginServer , refreshToken , reason );
475475 try {
476476 httpAccessor .getOkHttpClient ().newCall (request ).execute ();
477477 } catch (IOException e ) {
478478 SalesforceSDKLogger .w (TAG , "Exception thrown while revoking refresh token" , e );
479479 }
480480 }
481481
482+ protected static Request buildRevokeRefreshTokenRequest (URI loginServer , String refreshToken , LogoutReason reason ) {
483+ final String requestUrl = loginServer .toString () + OAUTH_REVOKE_PATH ;
484+ final FormBody body = new FormBody .Builder ()
485+ .add (TOKEN , refreshToken )
486+ .add (REVOKE_REASON , reason .toString ())
487+ .build ();
488+ return new Request .Builder ().url (requestUrl ).post (body ).build ();
489+ }
490+
482491 /**
483492 * Swaps a JWT for regular OAuth tokens. This is typically the first step after
484493 * receiving a JWT from a link. In addition, this will also call the identity
0 commit comments