Obtain an access token

Updated at:

Importing a third-party repository requires an account and an access token for authentication. The account should be the same one used for cloning over HTTPS on the specified platform. This topic describes how to obtain an access token from common code hosting platforms.

You typically manage access tokens in the personal account settings of a code hosting platform. This topic describes how to obtain access tokens for the following third-party platforms:

  • GitLab

  • Gitee

  • Coding

  • GitHub

  • Bitbucket

Obtain a GitLab access token

This example uses public GitLab. The procedure may vary slightly depending on your version:

  1. Log in to GitLab. In the upper-right corner, click your avatar, and then select Edit Profile.

  2. In the left navigation pane, select Access Tokens:

    • Enter a Token Name, for example, forcodeup.

    • In the Scopes section, select the read_repository checkbox.

    • Click Create personal access token.

    Note

    If you are importing from a self-managed GitLab instance, ensure the token has at least the following permissions. You may need to expand the authorization scope to include them:

    • api

    • read_user

    • read_repository

  1. After the token is created, copy and save it.

    At the top of the page, in the Your new personal access token section, click the copy icon next to the token value to copy it. The token is displayed only once and cannot be retrieved after you leave the page.

Obtain a Gitee access token

  1. Log in to Gitee. In the upper-right corner, click your avatar, and then select Account Settings.

  1. In the left navigation pane, select Personal Tokens, and then click Generate New Token.

  2. Configure the token parameters:

    • Enter a description for the personal access token, for example, forcodeup.

    • In the Permissions section, select at least the projects checkbox.

    Then, select the user_info permission and click Submit.

  3. In the confirmation dialog box, enter your password and click Confirm to create the token.

  4. After the token is created, copy and save it.

    In the Personal token generated dialog box, click the Copy button next to the token value. The token will not be displayed again after you close this dialog box. Once you have saved the token, select the confirmation checkbox and click Confirm and Close.

Obtain a Coding access token

  1. Log in to Coding. In the lower-left corner, click your avatar, and then select Personal Account Settings.

  1. In the left navigation pane, select Access Token, and then click New Token.

  2. Configure the token parameters:

    • Enter a Token description, for example, forcodeup.

    • Under Select Permissions, grant the following access:

      • User information: Read-only.

      • Project information: Read-only.

      • Credential information: Read-only.

      • Code repository:

        • Code repository: Read/Write.

        • Merge request: Read/Write.

        • Deployment public key: Read/Write.

        • Version management: Read/Write.

        • External repository: Read/Write.

    If you lose or forget the token, click Regenerate in the yellow notification bar to create a new one.

  3. In the confirmation dialog box, enter your login password, and click Confirm to create the token.

  4. After the token is created, copy and save it.

    When the token is created, the page displays its value. Copy the token immediately and store it securely, as it will not be shown again. On the Access Token page, you can view a list of your created tokens and their expiration dates. This page also displays your token username in the token's description.

Obtain a GitHub access token

  1. Log in to GitHub. In the upper-right corner, click your profile photo, and then select Settings.

  1. In the left navigation pane, click Developer settings.

  2. Select Personal access tokens, then select Tokens (classic), and click Generate new token.

    This page is located under GitHub Settings > Developer settings. Select the Tokens (classic) option.

  3. Configure the token parameters:

    • In the Note field, enter a description for the token, for example, forcodeup.

    • In the Select scopes section, select the repo checkbox.

    From the Expiration drop-down list, select a validity period for the token, for example, 30 days.

  4. After the token is created, copy and save it.

    The page will show a warning that the token is shown only once and cannot be retrieved. Copy and store the token in a secure location immediately.

Obtain a Bitbucket app password

  1. Log in to Bitbucket. In the lower-left corner, click your profile avatar, and then click Personal Bitbucket settings.

  2. In the navigation pane, select App passwords, and then click Create app password.

  3. Configure the parameters:

    • In the Details section, enter a Label, for example, forcodeup.

    • In the Permissions section, for Repositories, select the repo checkbox.

    Click Create.

  1. On the next page, copy the app password.

    A dialog box displays the app password and warns that it will not be shown again after the window is closed. After copying and saving the password, click Close.