Comments (7)
I'm new with PowerShell and GraphConnectors, so I'm looking for a sample in this case. But happy to contribute with other samples in the future when I get my arms around this :)
from graph-connectors-samples.
I haven't written anything in PowerShell, but I wrote the following code with help from ChatGPT, and it works. Feel free to use it in the commentary of the sample if you want.
$authURL = "https://xxx/oauth/token";
$creds = @{
client_id = "XXX"
client_secret = "XXX"
};
$authHeader = @{"content-type" = "application/x-www-form-urlencoded"}
$response = Invoke-RestMethod "$authURL" -Method Post -Body $creds -Headers $authHeader
$token = $response.access_token;
$authHeader = @{"Accept" = "application/json" ; "Authorization" = "Bearer $token"}
$apiUrl = "https://xxx";
$json = Invoke-RestMethod -Uri "$apiUrl" -Method Get -ContentType "application/json" -Header $authHeader
from graph-connectors-samples.
Thank you Nanddeep!
from graph-connectors-samples.
Thank you for the kind words, @daniel-alsen!
Since the sample you mentioned refers to an anonymous API, I suggest that we keep it as-is and instead work on creating a new sample. Is this something that you'd like to work on or are you rather looking for an example of how to solve it?
from graph-connectors-samples.
@nanddeepn, @SmitaNachan, see the question from @daniel-alsen above. Have you by any chance worked on creating a Graph connector in PowerShell, that's connected to an API behind OAuth? If so, would you be willing to share it? If not, is this something that perhaps you'd like to work together on to share with others? 😊
from graph-connectors-samples.
Hi @daniel-alsen
If you are looking for a sample to use App registration with App ID and Secret, you may refer this sample:
https://pnp.github.io/script-samples/teams-list-installed-apps/README.html?tabs=ps
from graph-connectors-samples.
Related Issues (11)
- Java: Use a logging framework instead of System prints
- Java: Update folder structure
- Don't hardcode URLs
- Add PowerShell setup script for the sample gallery connector
- samples/nodejs-javascript-solutiongallery createConnection failed HOT 7
- Upgrade the Python markdown sample to Microsoft Graph Python SDK GA
- Diagrams and Dark Mode HOT 3
- [BUG] [nodejs-typescript-food-catalog] Error thrown when disabling connection in TAC
- Order results not working... HOT 4
- [nodejs-typescript-food-catalog] "resultType.json" file not exist HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graph-connectors-samples.