Last active
          September 7, 2020 15:54 
        
      - 
      
- 
        Save ArnauMrJeff/b9dc5f3dd48a77d8922177b4c3810b24 to your computer and use it in GitHub Desktop. 
    Apple ID Sign In: AppleAuth
  
        
  
    
      This file contains hidden or 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
    
  
  
    
  | private void appleAuth(String authorizationCodeSentByApp, String keyIdentifierSentByApp) throws Exception { | |
| var token = generateJWT(); | |
| // Http Requests Client | |
| var tokenResponse = httpClient.getTokenResponse("CLIENT_ID", token, "authorization_code", authorizationCodeSentByApp); | |
| var idToken = tokenResponse.getIdToken(); | |
| // We had until here | |
| var claims = getClaims(keyIdentifierSentByApp, idToken); | |
| var iss = claims.get("iss", String.class); | |
| var aud = claims.get("aud", String.class); | |
| var exp = claims.get("exp", Date.class); | |
| var iat = claims.get("iat", Date.class); | |
| var appleIdentifier = claims.get("sub", String.class); | |
| var atHash = claims.get("at_hash", String.class); | |
| var authTime = claims.get("auth_time", Long.class); | |
| var email = claims.get("email", String.class); | |
| var emailVerified = claims.get("email_verified", String.class); | |
| // Do with params what you need to do | |
| } | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment