Skip to content

OAuth for CLI#12

Open
adivate2021 wants to merge 4 commits into
stagingfrom
aaryan/oauth-cli
Open

OAuth for CLI#12
adivate2021 wants to merge 4 commits into
stagingfrom
aaryan/oauth-cli

Conversation

@adivate2021
Copy link
Copy Markdown
Contributor

@adivate2021 adivate2021 commented May 20, 2026

@adivate2021 adivate2021 marked this pull request as draft May 20, 2026 01:32
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 1 potential issue.

View 6 additional findings in Devin Review.

Open in Devin Review

Comment thread src/judgment_cli/client.py Outdated
@adivate2021 adivate2021 marked this pull request as ready for review May 20, 2026 01:57
Comment thread src/judgment_cli/oauth.py Outdated
)
authorize_url = f"{auth_url.rstrip('/')}/oauth/authorize?{authorize_query}"

thread = Thread(target=server.serve_forever, daemon=True)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This needs to be killed right? This should not be a daemon either. The resource cleanup on this is imporant.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see the server is killed but what happens to the thread

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

should be fixed I think (not daemonized and proper cleanup)

Comment thread src/judgment_cli/config.py Outdated
api_key: str


def _config_dir() -> Path:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

i feel like there are so many 1 line functions that just call other functions that are invoked only one time like this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

removed this func

return AccessToken(self._api_key)

def refresh(self, *, force: bool = False) -> bool:
return False
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

shouldnt refresh be true?

Copy link
Copy Markdown
Contributor Author

@adivate2021 adivate2021 May 26, 2026

Choose a reason for hiding this comment

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

With API key auth there is nothing to refresh so its false

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what does the return value of refresh mean? Doesnt saying false indicates it failed to refresh?

Comment thread src/judgment_cli/credentials.py Outdated


class Credential(Protocol):
def get_token(self) -> AccessToken: ...
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why is both get_token and apply needed?
I think shouldnt create an object each time calling get_token

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed get_token

auth_url: str,
access_token: str,
refresh_token: str,
expires_at: int | None = None,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what is this token_updater used for now?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed

Comment thread src/judgment_cli/oauth.py
"state": query.get("state", [""])[0],
"error": query.get("error", [""])[0],
}
self.server.result_queue.put(result) # type: ignore[attr-defined]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

we dont do any other validation here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

added some more validation

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.

2 participants