Skip to content

Azure Devops Git Provider: Internal error exchanging Oauth code #6886

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
marleypowell opened this issue Mar 30, 2023 · 3 comments
Closed

Azure Devops Git Provider: Internal error exchanging Oauth code #6886

marleypowell opened this issue Mar 30, 2023 · 3 comments
Labels
waiting-for-info The issue creator is asked to provide more information.

Comments

@marleypowell
Copy link
Contributor

Current Behavior

When trying to use the ADO git provider I get this error:

{
  "message":"Internal error exchanging Oauth code.",
  "detail":"oauth2: cannot fetch token: 400 Bad Request\nResponse: {\"Error\":\"invalid_client\",\"ErrorDescription\":\"Failed to deserialize the JsonWebToken object.\"}"
}

Expected Behavior

The git provider successfully retrieves an access token.

@kylecarbs
Copy link
Member

Very odd... can you post the configuration you have for the Git auth provider? (without valid creds of course)

@kylecarbs kylecarbs added the waiting-for-info The issue creator is asked to provide more information. label Mar 30, 2023
@marleypowell
Copy link
Contributor Author

marleypowell commented Mar 30, 2023

This is the values.yaml for the auth provider:

coder:
  env: 
    - name: CODER_GITAUTH_0_ID
      value: "primary-azure-devops"

    - name: CODER_GITAUTH_0_TYPE
      value: "azure-devops"

    - name: CODER_GITAUTH_0_SCOPES
      value: "vso.code_full vso.tokenadministration"

    - name: CODER_GITAUTH_0_CLIENT_ID
      value: "..."

    - name: CODER_GITAUTH_0_CLIENT_SECRET
      valueFrom:
        secretKeyRef:
          name: coder-secrets
          key: CODER_GITAUTH_ADO_CLIENT_SECRET

    - name: CODER_GITAUTH_0_AUTH_URL
      value: "https://app.vssps.visualstudio.com/oauth2/authorize"

    - name: CODER_GITAUTH_0_TOKEN_URL
      value: "https://app.vssps.visualstudio.com/oauth2/token"

It's worth noting that I got Github to work as a git provider without any issues.

@marleypowell
Copy link
Contributor Author

The problem was that I accidentally used the App Secret instead of Client Secret for the Azure Devops App.

image

https://stackoverflow.com/questions/61303608/azure-devops-oauth-authentication-cannot-get-access-token-badrequest-failed-to

I've created a PR to add a bit more detail to the docs #6923

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting-for-info The issue creator is asked to provide more information.
Projects
None yet
Development

No branches or pull requests

2 participants