public static async Task <GroupShareClient> AuthenticateClient(string token, string user, string password, Uri baseAddress, IEnumerable <string> scopes) { var credentials = new Credentials(token, user, password); var inMemoryCredentials = new InMemoryCredentialStore(credentials); var groupShareClient = new GroupShareClient(inMemoryCredentials, baseAddress); return(groupShareClient); }
/// <summary> /// Creates a new instance of the GroupShare API v1 client that has the authorization token configured /// </summary> /// <param name="user">Provides the user for which to obtain the token.</param> /// <param name="password">Provides the password for the specified user.</param> /// <param name="baseAddress">The address to point this client to.</param> /// <param name="scopes">The token scope(s).</param> /// <returns></returns> public static async Task <string> GetRequestToken(string user, string password, Uri baseAddress, IEnumerable <string> scopes) { var credentials = new Credentials(user, password); var inMemoryCredentials = new InMemoryCredentialStore(credentials); var tokenGroupShareClient = new GroupShareClient(inMemoryCredentials, baseAddress); var authorization = await tokenGroupShareClient.Authenticate.Post(scopes); return(authorization.Token); }