OAuth and Powershell

I am trying to make a Powershell tool for myself that will allow me to get information about my characters (To Start).
I am under the impression I need to do an Oauth Request first before requesting information from the servers.
The problem is, I cannot seem to get it to work. Can anyone point me in the right direction of what to put in my Powershell script to get Oauth to work?

Powershell is not a programming language, just a shell scripting tool, so you’ll hit some limitations on what you can do.

I don’t really use powershell but I’ll try to help until someone with more knowledge comes along.

Can you use powershell as a HTTP server ? If you can’t act as a webserver you won’t be able to properly implement the authorization code flow necessary to get a list of your characters.

You might still be able to fetch each character since you can perform web requests and you only need the client credential flow to access character profiles.

If possible describe more about what you want to achieve so we can help you better.

Well, to start off I wanted to learn how to pull basic information from my account. Like characters, levels and what not. My future plan was to create a Powershell GUI to display all this information.
It seems like this will be limited based off your response. Do you have any recommendations as to the coding language I should use that wouldn’t limit me to basic things?
To make it clear, I want to develop a stand alone application for myself that can pull any of my information that blizzard allows so I can take that information and present it in a GUI.

For building a web application you have many choices: NodeJS, PHP, Ruby on Rails, Python, Java, C#, etc. As long as it can be used as a web server or run an embedded browser to display the battle.net login page you can use it.

You can check a list of community libraries so you don’t have to write everything from scratch.

All of them (plus some others I didn’t mention) can achieve the same result in a different way.

This is just my own opinion, but I think NodeJS and PHP are easier to learn. They are a good starting point. The one I prefer and enjoy coding is Ruby.

Example client credentials flow in PowerShell

$clientId = ''
$clientSecret = ''

$credential = [PSCredential]::new($clientId, (ConvertTo-SecureString 
$clientSecret -AsPlainText -Force))

$tokenInfo = Invoke-RestMethod -Uri https://us.battle.net/oauth/token -Method Post -Authentication Basic -Credential $credential -Body 'grant_type=client_credentials'

$token = ConvertTo-SecureString $tokenInfo.access_token -AsPlainText -Force

Invoke-RestMethod -Authentication Bearer -Token $token https://us.api.blizzard.com/..