Skip to content

Conversation

tonglil
Copy link
Contributor

@tonglil tonglil commented May 14, 2025

Closes #184 and #190.

Throw an error if a token does not exist when building the Authorization header.

When using the GitHub OAuth app to authenticate, this is the secure object:

secure {
  tokens: {
    access_token: 'ghu_xxxxxxxxxxxxxxxxxxx',
    token_type: 'bearer',
    scope: ''
  },
  expires_at: null
}

expires_at is null, so it always calls buildHeaders with an empty string (which doesn't make sense).

Removed this erroneous code and throw an error if the header is being built without a token.

}

return buildHeaders(secure?.tokens.access_token || '');
return buildHeaders(secure?.tokens?.access_token || '');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@karpikpl
Copy link
Collaborator

Thanks for the PR, let me review and test.
I never run it with OAuth app

@karpikpl karpikpl linked an issue Jun 5, 2025 that may be closed by this pull request
@karpikpl karpikpl merged commit dd53f68 into github-copilot-resources:main Jun 5, 2025
1 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GitHub OAuth App Authorization Issue 401 Unauthorized access | Check PAT token and GitHub permissions.
3 participants