I have a utility I've created for myself in WPF and it functions well, however, the next expansion to it needs me to be authenticated as a user (currently using Client Credentials). I was informed about the new library to help (OAuthWebView) but I'm really struggling to understand what I'm doing wrong.
I know the package isn't available via Nuget yet and I know the library is still a work in progress so not surprised if the documentation isn't fully there, but, I feel pretty dumb at the moment trying to follow it and referring to the examples.
As it isn't available by Nuget I downloaded the repo, but I'm not even entirely sure which files I need to add as references. I added some and it seems to have semi-worked (I can reference the OAuthWebView class) but in the ReadMe it talks about OAuthWebViewForm and I don't seem to be able to reference that.
Additionally, in the WPF example a UI element was added (AuthBrowser), but even if I add the OAuth namespace to my XAML (copied from the WPF example XAML) it gives me an error. I've tried pretty much each combination of steps I can think of but now definitely at the point where I need help. If anyone is able to assist, it would be truly appreciated. Once I get the auth part out of the way I'm fully confident about the next part.
References a Package that doesn't exist so even it can't run.
Instead you have to remove the Packages Reference and compile the GenesysCloudOAuthWebView that's part of the project and reference it via Project References;
then the project becomes runnable.
If you don't have your own personal NuGet you can stuff compiled versions into you probably have to resort to including the source as it's own project in your solution like the example does and referencing it as a project reference until the NuGet becomes available and you swap over and remove the extra projects.
Thank you - I have to admit a lot of that still went over my head. I think I get the first part (so I've removed all the references I had added before) but - I apologise - are you able to break this part down for me?
you probably have to resort to including the source as it's own project in your solution like the example does and referencing it as a project reference
You can include additional libraries in your project several ways;
Directly referencing a DLL or executable on your system.
Referencing a NuGet package like they did
Referencing a web service
Referencing another project in your solution
The last is what I did and am suggesting you do as an interim.
When you right click on Dependencies you should have the option to Add Project Reference and selecting that will list all the other projects in your solution, like the screen shot above.
Any project you select will be compiled before yours is, and it's output (dlls in this case) made available to the project declaring it as a dependency at compile time.
I don't know that I needed all three, but I grabbed the most logical ones just in case and it worked. You can probably play with it to determine if you need less than all three.
But for your own solution you'd basically have to import those projects and add them as dependencies to yours to ensure you have the library available until it's in the public NuGet
OK, great, I followed those steps and I was able to get the example project to run - so that is definitely progress.
In my project it doesn't run and I suspect it is because the project references are .NET Core (mine is .NET Framework - I know it is EOL).
So I suppose I either wait for the NuGet package or just start a new project and begin fresh for this part. The new functionality I need is really only POC for something bigger anyway so this should be fine.
Thank you for your help - I wouldn't have figured that out in a decade.
What version of .net framework are you targeting? those libraries are currently set to compile for netcoreapp3.1 and net472 so if you can target 4.72 they should work.
Ok, fair point, and I did that - and I was able to get it to run. I can get the login page to show in my app now when it launches, it authenticates me and even returns me an access token and the login "browser" closes.
However, if I try and do anything after that it fails and says I'm not authenticated. So... I need to figure that part out next.
Depending on how closely you copy-catted what they did, your token would be in AuthBrowser.AccessToken and you'd need to persist that further across your app to whatever was supplying/holding the token previously.
If you're combining it with the standard .NET SDK for example you would need to say something like;