public GetRequestToken ( ) : GeeklistSharp.Model.OAuthRequestToken | ||
리턴 | GeeklistSharp.Model.OAuthRequestToken |
public void GetAccessTokenAsyncTest() { string consumerKey = TestConstants.OAUTH_CONSUMER_KEY; // TODO: Initialize to an appropriate value string consumerSecret = TestConstants.OAUTH_CONSUMER_SECRET; // TODO: Initialize to an appropriate value GeeklistService target = new GeeklistService(consumerKey, consumerSecret); var requestToken = target.GetRequestToken(); Assert.IsNotNull(requestToken); Assert.IsFalse(requestToken.Token == "?" || requestToken.TokenSecret == "?"); var uri = target.GetAuthorizationUrl(requestToken.Token); Process.Start(uri.ToString()); var verifyer = "5444526"; // <-- Debugger breakpoint and edit with the actual verifier AutoResetEvent waitHandle = new AutoResetEvent(false); OAuthAccessToken accessToken = null; target.GetAccessTokenAsync((at) => { accessToken = at; waitHandle.Set(); },requestToken, verifyer); if (!waitHandle.WaitOne(5000, false)) { Assert.Fail("Test timed out."); } Assert.IsNotNull(accessToken); Assert.IsFalse(accessToken.Token == "?" || accessToken.TokenSecret == "?"); }
public void GetOOBRequestTokenTest() { string consumerKey = TestConstants.OAUTH_CONSUMER_KEY; // TODO: Initialize to an appropriate value string consumerSecret = TestConstants.OAUTH_CONSUMER_SECRET; // TODO: Initialize to an appropriate value GeeklistService target = new GeeklistService(consumerKey, consumerSecret); var token = target.GetRequestToken(); Assert.IsNotNull(token); Assert.IsFalse(token.Token == "?" || token.TokenSecret == "?"); }
public void GetAccessTokenTest() { string consumerKey = TestConstants.OAUTH_CONSUMER_KEY; // TODO: Initialize to an appropriate value string consumerSecret = TestConstants.OAUTH_CONSUMER_SECRET; // TODO: Initialize to an appropriate value GeeklistService target = new GeeklistService(consumerKey, consumerSecret); var requestToken = target.GetRequestToken(); Assert.IsNotNull(requestToken); Assert.IsFalse(requestToken.Token == "?" || requestToken.TokenSecret == "?"); var uri = target.GetAuthorizationUrl(requestToken.Token); Process.Start(uri.ToString()); var verifyer = "5444526"; // <-- Debugger breakpoint and edit with the actual verifier OAuthAccessToken accessToken = target.GetAccessToken(requestToken, verifyer); Assert.IsNotNull(accessToken); Assert.IsFalse(accessToken.Token == "?" || accessToken.TokenSecret == "?"); }
private GeeklistService GetAndTestAuthenticatedService() { string consumerKey = TestConstants.OAUTH_CONSUMER_KEY; // TODO: Initialize to an appropriate value string consumerSecret = TestConstants.OAUTH_CONSUMER_SECRET; // TODO: Initialize to an appropriate value GeeklistService service = new GeeklistService(consumerKey, consumerSecret); var requestToken = service.GetRequestToken(); Assert.IsNotNull(requestToken); Assert.IsFalse(requestToken.Token == "?" || requestToken.TokenSecret == "?"); var uri = service.GetAuthorizationUrl(requestToken.Token); Process.Start(uri.ToString()); var verifyer = "3935346"; // <-- Debugger breakpoint and edit with the actual verifier OAuthAccessToken accessToken = service.GetAccessToken(requestToken, verifyer); Assert.IsNotNull(accessToken); Assert.IsFalse(accessToken.Token == "?" || accessToken.TokenSecret == "?"); service.AuthenticateWith(accessToken.Token, accessToken.TokenSecret); return service; }