Create the Apex Classes

In this step, you create the Apex classes that call the API and do all of the heavy lifting.

  1. In Salesforce, from Setup, enter Apex Classes in the Quick Find box, then select Apex Classes.

  2. Click New.

  3. To create the JWT Apex class, copy all the code from JWT.apex into the Apex Class tab and click Save.

  4. To create the JWTBearerFlow Apex class, go back to to the Apex Classes page, and click New.

  5. Copy all the code from JWTBearer.apex to the Apex Class tab and click Save.

  6. To create the HttpFormBuilder Apex class, go back to the Apex Classes page, and click New.

  7. Copy all the code from HttpFormBuilder.apex into the Apex Class tab and click Save.

  8. To create the Vision Apex class, go back to the Apex Classes page, and click New.

  9. Copy all the code from Vision.apex into the Apex Class tab and click Save.

  10. To create the VisionController Apex class, go back to the Apex Classes page, and click New.

  11. Copy the VisionController code from the apex-utils README.md into the Apex Class tab. This class is all the code from public class VisionController { to the closing brace }. In this example, the expiration is one hour (3600 seconds).

  12. Update the jwt.sub placeholder text of yourname@example.com with your email address. Use your email address that’s contained in the Salesforce org you logged in to when you created an account.

Use your email address that’s contained in the Salesforce org you logged in to when you created an account. Be sure to use your email address and not your Salesforce username.

  1. Click Save.