현재 발급된 access token 및 refresh token을 폐기합니다.
GET https://auth.smtown.com/oauth/revoke
Authorization: Bearer 6c2260c458b0829d613f58f
| 파라메타 | 필수여부 | 설명 |
|---|---|---|
Authorization |
Header 필수 | Bearer token 입니다. 인증 섹션에서 발급 받은 access_token입니다. |
HTTP/1.1 200
revoke token은 api 호출 시 status code 200 이외에는 아무것도 반환하지 않습니다.
final private static String apiBaseURL = "https://auth.smtown.com";
final private static String profileEndPoint = "oauth/revoke";
final private static String accessToken = "2a324609ec94f18d614d4bc425de754";
public static void main(String[] args){
//implementation 'org.apache.httpcomponents:httpclient'
try (CloseableHttpClient client = HttpClients.createDefault()) {
HttpGet get = new HttpGet(String.format("%s/%s", apiBaseURL, profileEndPoint));
get.setHeader("Authorization", String.format("Bearer %s", accessToken));
client.execute(get);
} catch (IOException e){
throw new RuntimeException();
}
}
private readonly string ApiBaseURL = "https://auth.smtown.com";
private readonly string ProfileEndPoint = "oauth/revoke";
private readonly string AccessToken = "2a324609ec94f18d614d4bc425de754";
private async void GetAccessToken()
{
using System.Net.Http.HttpClient client = new(); System.Net.Http.HttpRequestMessage tokenRequest = new()
{
Method = HttpMethod.Get,
RequestUri = new Uri(string.Format("{0}/{1}", ApiBaseURL, ProfileEndPoint))
};
tokenRequest.Headers.TryAddWithoutValidation("Authorization", string.Format("Bearer {0}", AccessToken));
await client.SendAsync(tokenRequest);
}