Xcode 12 - GitHub Login Forced to use Personal Access Token - xcode

Xcode won't let me login to GitHub using my email and password, and is forcing me to use an account and personal access token. Of course, I could just generate a token and log in with that. However, I’d prefer not to have to use tokens - logging in with an email and password is just so much more simple.
Is this normal behavior, and is anyone else experiencing this? Maybe there is a workaround that I'm not aware of?

This is normal behavior. GitHub is deprecating their basic auth with username/password for their API. In fact, when you access them via Xcode with an old account you get an email about it:
Basic authentication using a password to the API is deprecated and
will soon no longer work. Visit
https://developer.github.com/changes/2020-02-14-deprecating-password-auth/
for more information around suggested workarounds and removal dates.

To do this, after you generate the token (recommend the repo token), go to xcode > Preferences > Accounts > GitHub
If SSH is shown: press Enter Password and a new screen appears with a placement for your token. When you enter the token, the protocol will change to HTTPS.
That's it.

Related

How to create an authorization token for remote login for heroku?

I am trying to access logs from an app. Apparently, the only way to do that is the herkoku client.
I am working remotely. When I do
heroku login -i
Error: Your account has MFA enabled; API requests using basic authentication with email and password are not supported. Please generate an authorization token for API access.
But there is no link provided where or how to get such a token.
And the documentation does not mention the creation of such a token. Only how to store it.
Any ideas?
While logged in to the Heroku web interface, go to "Account settings" (in the menu under your avatar in the top right) and scroll down to "API Key". Generate one if there isn't one already, or click "Reveal" to see the existing one.
Now, re-run heroku login -i, and enter your email as normal, but enter that API key instead of your account password.
The above method works. But: You have to type this password into the CLI. Cutting and pasting does not work.

"Failed to load owners" error in Xcode using GitHub

I am just starting out trying to connect Xcode to Github. I keep getting this peculiar error, saying "Failed to load owners" whenever I try to create a remote repository from within Xcode under the Source Control Manager. See the error here
If I ignore the warning, the upload then fails with this error.
I cannot seem to find anything online regarding this, and I cannot for the world notice anything being wrong with my GitHub account. The account itself is also accepted by Xcode (successfully added under the Accounts pane in Preferences).
Any help will be greatly appreciated.
In your GitHub account, when you are creating a personal access token to connect your Xcode to GitHub, you have to check off repo, write:packages, and read:packages.
Shown by the image here: https://i.stack.imgur.com/NUiiC.png
Then, you should be able to create the repo without any problems! Hope this helped.
I deleted my GitHub-Profile in the XCode Preferences and setted up again. After that it worked smoothly.
After having had a chat with a kind representative from GitHub Developer Support, it seems like it in my case had to do with my old username and password credentials that was saved on my machine. I quote:
Sometimes applications can use these old credentials, even if you
replace it with the personal access token.
Credentials for git authentication are stored in the Keychain App, and
git passes these onto GitHub when pushing changes to a Repository.
I'd suggest checking in the Keychain App for any records with the name
GitHub.
If they exist, delete those and try the push again.
Git should ask you to enter your username and password and once you
re-enter them, the correct credentials should be stored in your
Keychain app for future use.
So there you have it. This in fact solved my problem. It could also have had something to do with the personal access token that might not be set up with the proper permissions. If you have the same problem as I had you could also check out the scopes on your personal access token to verify it has access to everything you need. Step 7 on the help guide below has a screenshot of what that looks like:
https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line
For anyone who's looking for another way. What happened to me is that my personal access token expired, and I needed to generate a new one in Github / setting/ developer/ access token. After I generated a new one, I logged out of Github via Xcode, Logged back in and put in my new access code and cleared the issue!

Login with Google+ account programmatically

there is a service where one can authorize using their Google account.
I need to automate the workflow with that service, so my software has to log-in with a given Google account.
But as I've never done that before I don't know where to start. Most related answers suggest to display the authorization page to the user letting them to enter their login/password of their Google account, but that's not the case since my software must be fully automated, plus it is being ran in terminal mode so no browser neither any human to enter anything should be involved.
I wonder if such automation could be possible and where should I start.
The standard way to authenticate a user with google is through a three-legged oauth authentication flow (in a browser). You can do this in go using the oauth2 or with a more comprehensive package like goth
The general flow is:
redirect user to a landing page on google's site where they are prompted to grant you access.
google will make a callback to your site with a special code.
you make another request to exchange that code for an access token and a refresh token.
Use access token to use google apis, and use refresh token to get a new access token anytime it expires.
It is more detailed than this, and there is a lot to get right to keep it secure, but that is the general idea.
Now, like you've said, your app is a command line thing, so it is hard to do that flow. Unfortunately, you may need to do that once, just to get a refresh token. Once you have that, you could give it to your application: myapp -google-token=FOOBAR123, and your app can exchange the referesh token for a valid access token.
Maybe this will help: https://github.com/burnash/gspread/wiki/How-to-get-OAuth-access-token-in-console%3F

Source Tree and visualstudio.com personal access tokens: How to use the token?

I have just created a personal access token at visualstudio.com, because in SourceTree I could not manage to log in with my visualstudio.com e-mail and password. Now that I have the token, how to I use it? I cannot find any information online on how to use it in SourceTree. If I choose Clone/New, and enter the URL to the git repo, I am asked a username and password, not a token... Can anyone help please?
Just use a token as your per-application password.
VisualStudio.com used to have alternate authentication credentials (something like a second password), s.t. you don't need to trust 3rd-party applications with your MS account password. This has been refined in favor of access tokens, which allow to control access on a granular level (per application / service / read-only, read-write). This allows to enter such an access token e.g. on a 3rd-party build service, without fear that your main password is disclosed or mis-used (e.g. when the 3rd-party provider is hacked). Also, access can easily be revoked (instead of setting a new password and then entering it everywhere except for the application you don't trust / want to use anymore).
From a client applications point of view, the access token is just a password.

Parse.com validating user credentials every launch

On apps like twitter and snapchat, if you changed the password from the web, it wouldn’t allow you to get into the app without re-authenticating with the new password. When changing your password with Parse Open Source Framework, does it implement this functionality automatically on mobile or would the developer need to implement it themselves?
You have to do it by yourself. Check the following tutorial, section Handling an Invalidated Session:
https://parse.com/tutorials/integrating-facebook-in-android

Resources