Last active
October 4, 2018 18:27
-
-
Save ghsatpute/176d190cc417f09d2aceda4d455fe239 to your computer and use it in GitHub Desktop.
Getting access token from auth0
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Auth0Test { | |
public static void main(String[] args) { | |
AuthAPI auth = new AuthAPI("my-domain", "client-id", "client-secret"); | |
AuthRequest authRequest = auth.login("user-email", "user-password"); | |
try { | |
TokenHolder tokenHolder = authRequest.execute(); | |
String accessToken = tokenHolder.getAccessToken(); | |
String idToken = tokenHolder.getIdToken(); | |
Request<UserInfo> userInfoRequest = auth.userInfo(accessToken); | |
UserInfo user = userInfoRequest.execute(); | |
} catch(Auth0Exception e) { | |
e.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment