-
Notifications
You must be signed in to change notification settings - Fork 15
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
feat: add support to use PATs instead of OAuth #361
Open
thedadams
wants to merge
2
commits into
obot-platform:main
Choose a base branch
from
thedadams:oauth-pat-token-support
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+134
−126
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
thedadams
requested review from
cjellick,
njhale,
StrongMonkey,
iwilltry42 and
g-linville
January 22, 2025 01:52
Tools will now be able to specify, in their metadata, that their OAuth credential supports personal access tokens with the oauthPATSupported field being "true". If a tool does this, then the OAuth credential will prompt the user for a PAT instead of going through the OAuth flow. This change includes this field on the GitHub and Atlassian tools. Lastly, this change removes support for OAuth outside Obot. The OAuth credential tool will no longer look at the CLI config nor default to use the Gateway. Signed-off-by: Donnie Adams <[email protected]>
thedadams
force-pushed
the
oauth-pat-token-support
branch
from
January 22, 2025 16:01
ce01561
to
71f451d
Compare
g-linville
requested changes
Jan 22, 2025
oauth2/main.go
Outdated
defer g.Close() | ||
|
||
run, err := g.Run(context.Background(), "sys.prompt", gptscript.Options{ | ||
Input: fmt.Sprintf(`{"metadata": %s,"message":"Please enter your personal access token for %s.","fields":"Token","sensative": true}`, b, integration), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggested change
Input: fmt.Sprintf(`{"metadata": %s,"message":"Please enter your personal access token for %s.","fields":"Token","sensative": true}`, b, integration), | |
Input: fmt.Sprintf(`{"metadata": %s,"message":"Please enter your personal access token for %s.","fields":"Token","sensitive": true}`, b, integration), |
If this typo exists on the gptscript end, then it should be fixed there too.
Signed-off-by: Donnie Adams <[email protected]>
if !slices.Contains(strings.Split(strings.ToLower(os.Getenv("GPTSCRIPT_OAUTH_PAT_INTEGRATIONS")), ","), strings.ToLower(integration)) { | ||
fmt.Printf("All the following environment variables must be set: GPTSCRIPT_OAUTH_%s_AUTH_URL, GPTSCRIPT_OAUTH_%[1]s_REFRESH_URL, GPTSCRIPT_OAUTH_%[1]s_TOKEN_URL", normalizeForEnv(integration)) | ||
fmt.Printf("Or include %s in GPTSCRIPT_OAUTH_PAT_INTEGRATIONS to allow prompting for a personal access token\n", integration) | ||
os.Exit(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: return nil for consistency?
StrongMonkey
approved these changes
Jan 22, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Tools will now be able to specify, in their metadata, that their OAuth credential supports personal access tokens with the oauthPATSupported field being "true". If a tool does this, then the OAuth credential will prompt the user for a PAT instead of going through the OAuth flow.
This change includes this field on the GitHub and Atlassian tools.
Lastly, this change removes support for OAuth outside Obot. The OAuth credential tool will no longer look at the CLI config nor default to use the Gateway.
Issue: obot-platform/obot#1372