question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GitHub's PAT is recognized as a Token, not PersonalAccessToken

See original GitHub issue

Required Information

Type: Bug Task: GitHubRelease (v0/v1)

Environment

Issue Description

I’m implementing release pipeline which should create a draft release on each tag pushed. I’ve created a PAT (admin:repo_hook, repo, user permissions) and tried to create a release manually, it worked. Then I created a Service connection using this PAT. But when I run my pipeline, I’m getting this error: The pipeline is not valid. Job release: Step GitHubRelease input gitHubConnection expects a service connection of type github with authentication scheme OAuth,PersonalAccessToken but the provided service connection release2 is of type github using authentication scheme Token.

I tried to ask on similar issue (#9394) but no answer.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:7
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
ljvmiranda921commented, Dec 28, 2019

Ok, I was able to solve the problem above by creating a personal access token. You can do so by following the instructions here. The minimal scope for the token can be: Service Connections (Read, query, & manage). Be sure to click the “other 27 scopes” so this would appear.

create_access_token

After creating the token you need to (1) base64 encode it and (2) copy-paste it in your request. In my case, I just used Postman rather than the usual cURL since the former does step 1 automatically. For Postman, simply go to the “Authorization” tab and fill-in your Username and Password (the generated token)

params

Then for the request just go to Body, click the raw radio button. Then click the dropdown and change it from Text to JSON. You can then put the request as above (I’ll copy-paste it here for clarity):

{
  "name": "release",
  "type": "github",
  "url": "https://github.com",
  "authorization": {
    "scheme": "PersonalAccessToken",
    "parameters": {
      "accessToken": "<TODO-GITHUB-PERSONAL-ACCESS-TOKEN>"
}
  }
}

By clicking the Send command, you should be able to confirm that the Service Connection has been created properly:

verify


Can also be found in my blog here: https://ljvmiranda921.github.io/notebook/2019/12/28/workaround-azure-github-pat/

2reactions
amaslenncommented, Dec 16, 2019

@twpayne I created a Personal Access Token in Azure and used it with curl:

curl -u USER:PAT https://dev.azure.com/{{ORG}}/...

Got smth like this as the final cmd: curl -u USER:PAT -d '{"name": "release","type": "github","url": "https://github.com","authorization":{"scheme":"PersonalAccessToken","parameters":{"accessToken":"GITHUB_PAT"}}}' -H "Content-Type: application/json" -X POST 'https://dev.azure.com/{{ORG}}/{{PROJ}}/_apis/serviceendpoint/endpoints?api-version=5.1-preview'

Hope it helps.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Personal Access Token not being accepted/recognised when ...
I created a Personal Access Token (PAT) on Github so that I could clone a repo for local access. When terminal asks for...
Read more >
Chapter 9 Personal access token for HTTPS
With HTTPS, we will use a personal access token (PAT). ... Let it be known that the password that you use to login...
Read more >
Help! Personal Access Tokens not working : r/github - Reddit
From prior experience, I know that you must give proper permissions to PAT (Personal Access Tokens). For example, if you would like whatever...
Read more >
GitHub Personal Access Token not working
In SourceTree I open Preferences, click Accounts, click the GitHub account, click Edit and past the PAT into the password field. It appears...
Read more >
Setting Up a Personal Access Token via R - The Carpentries
This error often means that you have your password stored in your keychain instead of your token. This seems like a weird error...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found