public string GetAuthUrl(string callbackUri, EsiScope scope, string state) { var escScopes = Uri.EscapeDataString(string.Join(" ", EsiScopeMap.GetScopeStrings(scope))); var escCallback = Uri.EscapeDataString(callbackUri); var escState = Uri.EscapeDataString(state); return($"https://login.eveonline.com/oauth/authorize?response_type=code&redirect_uri={escCallback}&realm=ESI&client_id={_clientId}&scope={escScopes}&state={escState}"); }
public static IEnumerable <string> GetScopeStrings(EsiScope scope) { foreach (var kv in Strings) { if (scope.HasFlag(kv.Value)) { yield return(kv.Key); } } }
public static EsiScope GetScopeEnum(params string[] scopes) { EsiScope scope = 0; foreach (var str in scopes) { scope |= Strings[str]; } return(scope); }