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 |
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
import com.fasterxml.jackson.annotation.JsonProperty; | |
public final class ApplePublicKey { | |
private final String kty; | |
private final String kid; | |
private final String use; | |
private final String alg; | |
private final String n; | |
private final String e; |
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
import com.fasterxml.jackson.annotation.JsonProperty; | |
public final class ListApplePublicKey { | |
private final List<ApplePublicKey> keys; | |
public ListApplePublicKey(@JsonProperty("keys") List<ApplePublicKey> keys) { | |
this.keys = keys; | |
} |
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
import io.jsonwebtoken.Claims; | |
import io.jsonwebtoken.JwsHeader; | |
import io.jsonwebtoken.Jwts; | |
import io.jsonwebtoken.SignatureAlgorithm; | |
import org.bouncycastle.asn1.pkcs.PrivateKeyInfo; | |
import org.bouncycastle.openssl.PEMParser; | |
import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter; | |
import java.security.KeyFactory; | |
import java.security.NoSuchAlgorithmException; |
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
import io.jsonwebtoken.Claims; | |
import io.jsonwebtoken.JwsHeader; | |
import io.jsonwebtoken.Jwts; | |
import io.jsonwebtoken.SignatureAlgorithm; | |
import org.bouncycastle.asn1.pkcs.PrivateKeyInfo; | |
import org.bouncycastle.openssl.PEMParser; | |
import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter; | |
import java.security.KeyFactory; | |
import java.security.NoSuchAlgorithmException; |
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(); | |
// Next Steps | |
} |
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
import com.fasterxml.jackson.annotation.JsonProperty; | |
public final class TokenResponse { | |
private final String idToken; | |
private final String accessToken; | |
private final String tokenType; | |
private final Long expiresIn; | |
private final String refreshToken; |
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
import io.jsonwebtoken.Claims; | |
import io.jsonwebtoken.JwsHeader; | |
import io.jsonwebtoken.Jwts; | |
import io.jsonwebtoken.SignatureAlgorithm; | |
import org.bouncycastle.asn1.pkcs.PrivateKeyInfo; | |
import org.bouncycastle.openssl.PEMParser; | |
import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter; | |
import java.io.File; | |
import java.io.FileReader; |
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
import io.jsonwebtoken.Claims; | |
import io.jsonwebtoken.JwsHeader; | |
import io.jsonwebtoken.Jwts; | |
import io.jsonwebtoken.SignatureAlgorithm; | |
import org.bouncycastle.asn1.pkcs.PrivateKeyInfo; | |
import org.bouncycastle.openssl.PEMParser; | |
import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter; | |
import java.io.File; | |
import java.io.FileReader; |