Using Personal Access Tokens

Use cases involving the automation of the interaction with the NAPPTIVE Playground such as CI integrations, or executions triggered by scripts are not possible with OAuth authentication mechanisms as there is no possibility to open a window browser, nor is there a user that can answer the OAuth challenge.

Personal Access Tokens (PAT) represent an alternative method to using passwords, and provide access to Playground resources on behalf of yourself.

Personal Access Tokens

The following sections will guide your through common operations involving PAT:


Create new token

To create a new Personal Access Token, click on the icon User on the lower side of the left-hand screen to access your user info. And in the User modal window click on the PATs(Personal Access Token) tab.

Next, click on Create token button on the top right hand corner of the section (or in the here word that appears if the token list is empty). Once the Create token input is shown, type a name for the token (it must be at least 3 characters long, lowercase and no spaces or special chars are allowed except ‘-‘), and click on the Create token button. Wait few seconds for the token to be generated and the token value will be displayed.

Personal Access Tokens Account button Create new token input Account button Token value

IMPORTANT - Copy or download value token in a secure location, because it will not be shown again for security reasons.

To finish the token creation and refresh the available tokens list, click on Complete button.


Deleting a Token

Deleting a token is as easy as clicking on the Delete button Delete button on the bottom part of all the items when expanded available on the right part of each token

Account button

Delete button on each token in the list


Personal Access Token with the CLI

Personal Access Token can also be generated and managed through the CLI with the following commands:

  • To create a token, execute:
playground user pat create ci_pat
NAME      TOKEN
ci_pat    <your token>

Please store this value safely as it cannot be retrieved once generated.
To login with this value, set the environment variable PLAYGROUND_PAT
with the token, or save it to a file. Use 'playground login --pat' to
og into the NAPPTIVE Playground without OAuth.

Alternatively, you can store the contents of the generated pat with:

playground user pat create test_pat --patFile /tmp/test_pat.dat
You can use this Personal Access Token to log into the NAPPTIVE
Playground using the following command:

$ playground login --patFile /tmp/test_pat.dat
  • To list the existing tokens, execute:
playground user pat list
NAME        LAST_LOGIN
ci_pat      2021-04-06 18:16:28 +0200 CEST
test_pat    2021-04-06 18:18:19 +0200 CEST
  • To delete a token, execute:
playground user pat delete mypat
STATUS     INFO
SUCCESS    Removed

Note that this operation removes the token from the system. Sessions that have already been negotiated using this token will not be invalidated.


Login with a Personal Access Token (PAT)

There are two methods to use PAT. First, you can set the environment variable PLAYGROUND_PAT with the contents of the token, and execute:

playground login --pat
...

Alternatively, you can load the PAT from a file using:

playground login --patFile /tmp/test_pat.dat
...

Both methods will provide you access to interact normally with your Napptive Playground account.


FAQ

Invalid character U looking for beginning value

$ playground login --pat
invalid character 'U' looking for beginning of value

This is usually related with the value of PLAYGROUND_PAT a likely cause by the terminal copy & paste settings. Make sure no trailing newline characters (\n) are included at the end.


What’s next

  • Check our deploy tutorials on the different methods to deploy applications.
  • Clone our cd-example repository and discover how you can integrate a QA pipeline with the NAPPTIVE Playground.