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

Add tokenauth example #1551

Merged
merged 5 commits into from Jun 17, 2020
Merged

Add tokenauth example #1551

merged 5 commits into from Jun 17, 2020

Conversation

tteeoo
Copy link
Contributor

@tteeoo tteeoo commented Jun 5, 2020

Basic authentication via username and password for the GitHub API is deprecated and will be discontinued November 13, 2020.
As such, I think It's important to have an example for how to use a personal access token to authenticate.
This new tokenauth example is completely identical to basicauth except it creates a *github.Client using oauth2.StaticTokenSource.

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@codecov
Copy link

codecov bot commented Jun 5, 2020

Codecov Report

Merging #1551 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1551   +/-   ##
=======================================
  Coverage   67.92%   67.92%           
=======================================
  Files          94       94           
  Lines        8670     8670           
=======================================
  Hits         5889     5889           
  Misses       1880     1880           
  Partials      901      901           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2c8de65...0a97c14. Read the comment docs.

@tteeoo
Copy link
Contributor Author

tteeoo commented Jun 5, 2020

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

memo Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.

What to do if you already signed the CLA

Individual signers
* It's possible we don't have your GitHub username or you're using a different email address on your commit. Check [your existing CLA data](https://cla.developers.google.com/clas) and verify that your [email is set on your git commits](https://help.github.com/articles/setting-your-email-in-git/).
Corporate signers
* Your company has a Point of Contact who decides which employees are authorized to participate. Ask your POC to be added to the group of authorized contributors. If you don't know who your Point of Contact is, direct the Google project maintainer to [go/cla#troubleshoot](http://go/cla#troubleshoot) ([Public version](https://opensource.google/docs/cla/#troubleshoot)).

* The email used to register you as an authorized contributor must be the email used for the Git commit. Check [your existing CLA data](https://cla.developers.google.com/clas) and verify that your [email is set on your git commits](https://help.github.com/articles/setting-your-email-in-git/).

* The email used to register you as an authorized contributor must also be [attached to your GitHub account](https://github.com/settings/emails).

information_source Googlers: Go here for more info.

@googlebot I signed it!

@googlebot
Copy link

CLAs look good, thanks!

ℹ️ Googlers: Go here for more info.

@googlebot googlebot added cla: yes Indication that the PR author has signed a Google Contributor License Agreement. and removed cla: no labels Jun 5, 2020
@tteeoo tteeoo closed this Jun 5, 2020
@tteeoo tteeoo reopened this Jun 5, 2020
Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

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

Thank you, @tteeoo.
Just a few minor nits, and then we should be good to merge after a second LGTM.

example/tokenauth/main.go Outdated Show resolved Hide resolved
example/basicauth/main.go Outdated Show resolved Hide resolved
example/basicauth/main.go Outdated Show resolved Hide resolved
example/basicauth/main.go Show resolved Hide resolved
Formatted comments better for godoc and added a line in basicauth
directing to tokenauth for more details.
Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

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

Thank you, @tteeoo!
LGTM.

Awaiting second LGTM before merging.

Copy link
Collaborator

@wesleimp wesleimp left a comment

Choose a reason for hiding this comment

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

LGTM 👌

@gmlewis
Copy link
Collaborator

gmlewis commented Jun 17, 2020

Thank you, @wesleimp!
Merging.

@gmlewis gmlewis merged commit 57406a8 into google:master Jun 17, 2020
n1lesh pushed a commit to n1lesh/go-github that referenced this pull request Oct 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Indication that the PR author has signed a Google Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants