Code Monkey home page Code Monkey logo

Comments (7)

daniel-alsen avatar daniel-alsen commented on July 17, 2024 1

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.

daniel-alsen avatar daniel-alsen commented on July 17, 2024 1

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.

daniel-alsen avatar daniel-alsen commented on July 17, 2024 1

Thank you Nanddeep!

from graph-connectors-samples.

waldekmastykarz avatar waldekmastykarz commented on July 17, 2024

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.

waldekmastykarz avatar waldekmastykarz commented on July 17, 2024

@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.

nanddeepn avatar nanddeepn commented on July 17, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.