The next step is to make an HTTP POST callout with the body assertion obtained in the previous section. The following is the code for the same (you can view the entire code at https://github.com/PacktPublishing/Learning-Salesforce-Einstein/blob/master/Chapter6/SalesforceEinsteinVision/src/classes/EinsteinVisionJWTBearerTokenExchange.cls):
public static String getAccessToken(String accountId, Integer expirationTime, String privateKeyString ) { String tokenendPoint = 'https://api.metamind.io/v1/oauth2/token'; String access_token = null; String body = 'grant_type=urn%3Aietf%3Aparams%3Aoauth%3Agrant-type%3Ajwt- bearer&assertion='+ EinsteinVisionJWT.issue (accountId,expirationTime,privateKeyString); HttpRequest req ...