Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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