public static AuthLevelToString ( AuthLevel level ) : string | ||
level | AuthLevel | The level to convert. |
리턴 | string |
/// <summary> /// Returns the authorization URL for OAuth authorization, based off the request token and permissions provided. /// </summary> /// <param name="requestToken">The request token to include in the authorization url.</param> /// <param name="perms">The permissions being requested.</param> /// <returns></returns> public string OAuthCalculateAuthorizationUrl(string requestToken, AuthLevel perms) { string permsString = (perms == AuthLevel.None) ? "" : "&perms=" + UtilityMethods.AuthLevelToString(perms); return(AuthUrl + "?oauth_token=" + requestToken + permsString); //return AuthUrl + "http://www.flickr.com/services/oauth/authorize?oauth_token=" + requestToken + permsString; }
public string OAuthCalculateAuthorizationUrl(string requestToken, AuthLevel perms, bool mobile = false) { var permsString = (perms == AuthLevel.None) ? "" : "&perms=" + UtilityMethods.AuthLevelToString(perms); return("https://" + (mobile ? "m" : "www") + ".flickr.com/services/oauth/authorize?oauth_token=" + requestToken + permsString); }
public string AuthCalcUrl(string frob, AuthLevel authLevel) { if (sharedSecret == null) { throw new SignatureRequiredException(); } string hash = sharedSecret + "api_key" + apiKey + "frob" + frob + "perms" + UtilityMethods.AuthLevelToString(authLevel); hash = UtilityMethods.MD5Hash(hash); string url = AuthUrl + "?api_key=" + apiKey + "&perms=" + UtilityMethods.AuthLevelToString(authLevel) + "&frob=" + frob; url += "&api_sig=" + hash; return(url); }
/// <summary> /// Calculates the URL to redirect the user to Flickr web site for /// authentication. Used by Web applications. /// See <see cref="AuthGetFrob"/> for example code. /// </summary> /// <param name="authLevel">The <see cref="AuthLevel"/> stating the maximum authentication level your application requires.</param> /// <param name="extra">An extra string value which Flickr will return to the callback URL along with the frob.</param> /// <returns>The url to redirect the user to.</returns> public string AuthCalcWebUrl(AuthLevel authLevel, string extra) { CheckApiKey(); CheckSigned(); string hash = sharedSecret + "api_key" + apiKey + "perms" + UtilityMethods.AuthLevelToString(authLevel); string url = AuthUrl + "?api_key=" + apiKey + "&perms=" + UtilityMethods.AuthLevelToString(authLevel); if (!String.IsNullOrEmpty(extra)) { hash += "extra" + extra; url += "&extra=" + Uri.EscapeDataString(extra); } hash = UtilityMethods.MD5Hash(hash); url += "&api_sig=" + hash; return(url); }