Skip to content

Instantly share code, notes, and snippets.

@bdemers
Created November 18, 2020 21:33
Show Gist options
  • Save bdemers/b02a25d46ed44af11fb413bf09f3eb77 to your computer and use it in GitHub Desktop.
Save bdemers/b02a25d46ed44af11fb413bf09f3eb77 to your computer and use it in GitHub Desktop.
Simple Spring Access Token Tool
@SpringBootApplication
public class TokenViewerApplication {
public static void main(String[] args) {
SpringApplication.run(TokenViewerApplication.class, args);
}
@RestController
static class TokenController {
@GetMapping("/token")
String showToken(@RegisteredOAuth2AuthorizedClient("okta") OAuth2AuthorizedClient client) {
return "export TOKEN='" + client.getAccessToken().getTokenValue() + "'";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment