Skip to content
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

Cannot directly pass SecretString for token auth #594

Closed
flying-sheep opened this issue Mar 5, 2024 · 2 comments · Fixed by #601
Closed

Cannot directly pass SecretString for token auth #594

flying-sheep opened this issue Mar 5, 2024 · 2 comments · Fixed by #601

Comments

@flying-sheep
Copy link
Contributor

flying-sheep commented Mar 5, 2024

Given I have

let github_token: secrecy::SecretString = ...;

I can either do

octocrab::Octocrab::builder()
	.personal_token(github_token.expose_secret().to_owned())
	.build()?,

or, if I knew how to do that,

octocrab::OctocrabBuilder::new_empty()
	.with_auth(octocrab::auth::Auth::PersonalToken(github_token))
	.with_service(???)
	.with_layer(???)
	.build()?,

It seems weird to me that OctocrabBuilder<..., DefaultOctocrabBuilderConfig, NoAuth, ...>::personal_token(...) returns Self and not OctocrabBuilder<..., Auth, ...>.

@XAMPPRocky
Copy link
Owner

Thank you for your issue! That does seems like an oversight, I'd be happy to review a a PR that makes this possible.

@flying-sheep
Copy link
Contributor Author

Done! I still wonder about the way OctocrabBuilder’s type parameters work, but that’s not relevant for this PR.

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 a pull request may close this issue.

2 participants