Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authentication in sample code not working - token parameter required #140

Open
kothes-support opened this issue Sep 22, 2021 · 2 comments
Open

Comments

@kothes-support
Copy link

kothes-support commented Sep 22, 2021

Hello,
I just downloaded the Groupsharekit from NuGet in Visual Studio and wanted to test this sample code:

var groupShareClient = await GroupShareClient.AuthenticateClient(userName, password, new Uri("http://yourgroupshareaddress"), GroupShareClient.AllScopes);

var users = await groupShareClient.User.GetAllUsers();

foreach (var user in users)
{
    Console.WriteLine(user.DisplayName +" loves Groupshare!");
}

Unfortunately it was not working because a token parameter is required for this method:
GroupShareClient.AuthenticateClient(string token, string user, string password, string bearerId, Uri baseAddress, IEnumerable<string> scopes)

I am not that familiar with using REST-API, I just want to use the C# wrapper. But it does not seem that there is any more sample code anywhere or is there?
Where do I get the required token from? ist it stored somewhere in the Groupshare server?
Any additional documentation would be greatly appreciated.
Thanks!

@kothes-support
Copy link
Author

kothes-support commented Sep 24, 2021

I was finally able to fix your sample code and make this example work. Just in case it might be useful to someone.

But still I would like to know if there is an API-Doc for all the c# classes, methods and data types? Some simple examples would be very nice, too.

var token = await GroupShareClient.GetRequestToken("user", "password", new Uri("http://myServer"), GroupShareClient.AllScopes);
Console.WriteLine(token);

var groupShareClient = await GroupShareClient.AuthenticateClient(token, "user", "password", null, new Uri("http://myServer"), GroupShareClient.AllScopes);

var users = await groupShareClient.User.GetAllUsers(new UsersRequest(1, 1, Int16.MaxValue));

foreach (UserDetails ur in users.Items)
{
       Console.WriteLine(ur.DisplayName + " loves Groupshare!");
}

@kothes-support
Copy link
Author

I realized that the information inside the object "UserDetails" is incomplete. Besides the "DisplayName" all other properties have value "null". This way it is practically useless when trying to loop over all users and looking for a specific e-mail or ID e.g..
I also posted the problem with screenshot to the RWS community boards:
https://community.rws.com/developers-more/developers/language-developers/f/sdk_qa/40616/groupsharekit---getallusers-return-incomplete-information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant