Get an Oauth2 Token in a Command Line Program

Argggh. I just damaged the token that I had in my configuration.

I forgot how I got it in the first place; I probably used some small program that used the web browser, or I got it from the developer site, or something. I really don’t remember.

What’s the Problem?

A web app using OAuth2 delegates the login process (and application permissions) to an OAuth2 server. Usually, this is Google, Twitter, or Facebook. You see the “Login with…” buttons.

When you are joining or logging onto a site, you see those buttons. You click on one, and get a window or dialog with the external service. You perform the logon, and then return to the original site.

The OAuth2 application flow involves showing a web page to the user, and getting a redirect URL back to the application. The redirect contains an access token. We need to get that token.

Microsoft services have a Python library to do the magic. It’s called MSAL (previously ADAL).

I need something like that for Ebay. Fortunately Ebay has libraries for this.

Okta has an interesting example: it runs an HTTP server that interacts with the Oauth2 server.

Here’s another Okta post about it. These articles are so instructive.

IBM products have their own tech

How to Authenticate using Keys, BasicAuth, OAuth2 in JavaScript

Was this helpful?

0 / 0

Leave a Reply