Tune in to Trailblazers Innovate for Salesforce product news,
demos, and latest roadmaps. Register here.
close
Start tracking your progress
Trailhead Home
Trailhead Home

Enable Dev Hub and Create a Connected App

Retrieve Your Salesforce Username and Password

You need both your Trailhead Playground's username and password to set up automatic authentication with GitLab. To get both, follow the password reset process.

  1. Click the Setup icon The Setup gear icon.and select Setup.
  2. Enter users in the Quick Find box, then click Users.
  3. Select the checkbox next to your name. Make a note of the username; it will be needed later in this project.
  4. Click Reset Password(s), then OK. A password reset email is sent to the email address associated with your username. Be sure to check your spam folder if you don't see the email.
    The user list in Setup, with the Trailhead learner name and email, as well as the Reset Password(s) button, highlighted by red boxes.
  5. Click the link in the email.
  6. Set and make a note of your Trailhead Playground password. You need it later in this project.

Enable Dev Hub

For this project, go ahead and enable Dev Hub in the Trailhead Playground you just set up.

  1. From Setup, enter Dev Hub in the Quick Find box and select Dev Hub.
  2. Click Enable Dev Hub then click Enable Unlocked Packages and Second-Generation Managed Packages. Enable Dev Hub and Second Generation Packaging from Setup

Create a Salesforce Connected App

A connected app is required to build the integration with GitLab. Let’s go ahead and set this up while you have your Trailhead Playground open.

  1. From Setup, enter App Manager in the Quick Find box and select App Manager.
  2. Click New Connected App.
  3. You work with the DreamHouse app in this project. Let’s update the basic required information.
    1. Connected App Name: DreamHouse_demo
    2. API Name: DreamHouse_demo
    3. Contact email: enter your email in this field
    4. You can leave all other fields in Basic Information blank. (If you like, you can add a fun logo image in the Logo Image URL. We’re partial to Astro.)
      Basic Information section of new Connected App form
  4. Configure the following for the API (Enable OAuth Settings) section.
    1. Enable OAuth Settingschecked
    2. Callback URL: http://localhost:1717/OauthRedirect
    3. Selected OAuth Scopes:
      • Access and manage your data (api)
      • Perform requests on your behalf at any time (refresh_token, offline_access)
      • Provide access to your data via the Web (web)
    4. Require Secret for Web Server Flow: checked
      API Settings for new Connected App form
  5. Click Save, then Continue.
  6. Make a note of the Consumer Key. You should see it as the first field under the API (Enable OAuth Settings) section. You need this later in the project.
    Consumer Key of the DreamHouse_demo Connected App
  7. Next, click Manage then Edit Policies–let’s update admin permissions so the app interacts properly with GitLab.
  8. In the OAuth Policies section, select Admin approved users are pre-authorized for Permitted Users. If you get a message saying that enabling this option will result in all users currently using this app being denied access, that's okay because this is a new app and no one has previously used it yet. Go ahead and click OK.
    Connected App policy that admin-approved users are pre-authorized
  9. Click Save to return to the setup page for your connected app.
  10. To pre-authorize users to use this connected app, scroll down to the Profiles section and click Manage Profiles.
    Profiles and Permission Sets section to pre-authorize users to a Connected App
  11. Select the profiles that are pre-authorized to use this connected app. Add Standard User and System Administrator.
  12. Click Save.

All right, you’re all set up with your connected app. It’s time to start building the CI/CD pipeline.

Note

Note

After creating or updating a connected app, please allow at least 10 minutes for the changes to take effect across Salesforce systems before trying to use it. You can receive invalid grant errors if you try to use a connected app before it's provisioned. If you receive errors, wait 10 minutes then try again.

Resources