// Returns a Tuple<userId, refreshToken> public static async Task <Tuple <string, string> > Login(Credentials credentials, Uri serverUrl) { var result = await MakeAuthRequestAsync(serverUrl, credentials.ToDictionary(), TimeSpan.FromSeconds(30)).ConfigureAwait(continueOnCapturedContext: false); var refreshToken = result["refresh_token"]; return(Tuple.Create(refreshToken["token_data"]["identity"].Value <string>(), refreshToken["token"].Value <string>())); }
// Returns a Tuple<userId, refreshToken> public static async Task <UserLoginData> Login(Credentials credentials, Uri serverUrl) { var result = await MakeAuthRequestAsync(serverUrl, credentials.ToDictionary(), TimeSpan.FromSeconds(30)).ConfigureAwait(continueOnCapturedContext: false); var refreshToken = result["refresh_token"]; return(new UserLoginData { RefreshToken = refreshToken["token"].Value <string>(), UserId = refreshToken["token_data"]["identity"].Value <string>(), IsAdmin = refreshToken["token_data"]["is_admin"].Value <bool>() }); }
// Returns a Tuple<userId, refreshToken> public static async Task <UserLoginData> Login(Credentials credentials, Uri serverUrl) { var body = credentials.ToDictionary(); body["app_id"] = AppId; var result = await MakeAuthRequestAsync(HttpMethod.Post, new Uri(serverUrl, "auth"), body).ConfigureAwait(continueOnCapturedContext: false); var refreshToken = result["refresh_token"]; return(new UserLoginData { RefreshToken = refreshToken["token"].Value <string>(), UserId = refreshToken["token_data"]["identity"].Value <string>(), IsAdmin = refreshToken["token_data"]["is_admin"].Value <bool>() }); }