C# or vb connect to OKTA API

Hello,

How can I connect to the okta API using restful calls from a c# or vb program ?

Then I’d like to issue simple API retrival commands such as list users in a group.

By restful I also mean that I can’t bind in any OKTA nuget packages into my app or use the oktaclient object, it all has to be done from raw httpget and httppost

thanks
Paul

That’s probably a question to c# and VB forum, as all I see is you asking how to do HTTP get/post from your code. Please correct me if I’m wrong.

I got there in the end. It’s so hard to find examples and so many examples are very complex. It was very simple in the end:

        Try

            Dim t As String = "my okta api key"

            Dim h As New http

            h.AddHeader("Authorization", "SSWS " & t)

            Dim s As String = h.HTTPGetNet("https://dev-xxx-admin.okta.com/api/v1/users", "application/json")

            Console.WriteLine(s)

            Console.ReadLine()

        Catch ex As Exception
            Console.WriteLine("error:" & ex.Message)
        End Try

http is a simple local class to do http gets, and could be replaced with webclient or whatever

2 Likes

There you go! Well done! Now people can find your post and repeat or enhance your solution. Thank you for sharing :+1:

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.