Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Github API Cannot Set User Emails

I'm trying to synchronize user names and primary emails with AD via the Github API. I make a call to /user/emails using an oAuth token with scope user:email and I get back their primary email. I then try to use PATCH /user per this doc with the payload:

{
   email: [email protected]
}

And I get back a 404.

Is this the correct method to set the primary emails for users?

like image 569
Richard Schaefer Avatar asked Dec 12 '19 12:12

Richard Schaefer


People also ask

Can you change GitHub email?

You can change the email address associated with your personal account at any time. Note: You cannot change your primary email address to an email that is already set to be your backup email address.


1 Answers

This is due to your API request is not properly authenticated or your OAuth token does not have the required scopes. As per your question, you have set user:email scope which does not allow modification of the profile. Use user scope intead.

Scopes in Githup API

See more: Why am I getting a 404 error on a repository that exists?

like image 98
DinushaNT Avatar answered Nov 15 '22 08:11

DinushaNT