public static void DoSomeOauth2()
        {
            var request_factory = new OAuth2.Infrastructure.RequestFactory();

            request_factory.CreateRequest();
            request_factory.CreateClient();



            var config = new OAuth2.Configuration.RuntimeClientConfiguration();

            config.ClientId     = CLIENT_ID;
            config.ClientSecret = CLIENT_SECRET;
            config.RedirectUri  = REDIRECT.ToString();



            var oauthin = new OAuth2.Client.Impl.GoogleClient(request_factory, config);

            oauthin.GetCurrentToken();



            service        = new RequestService(HANDLER);
            Program.config = new CanvasConfig(DOMAIN, CLIENT_ID, CLIENT_SECRET, REDIRECT);

            var request = new ApiRequest(new Uri("https://instantadmin.instructure.com/login/oauth2/auth"))
                          .Param("client_id", CLIENT_ID)
                          .Param("response_type", "code")
                          .Param("redirect_uri", REDIRECT.ToString())
            ;

            //var basic = await HANDLER.ExecuteAsync<OAuth2Session>(request).ConfigureAwait(false);

            //session = new OAuth2Session(access_token, refresh_token, expires_in, token_type);
            auth = new AuthRepository(Program.config, service, CONVERTER);

            client = new Client(Program.config, auth);

            //var courses = await client.CoursesManager.GetAll();

            //foreach(var course in courses)
            //{
            //    Console.WriteLine(course.ToString());
            //}


            //return;
        }
Example #2
0
 public void SetUp()
 {
     // arrange
     factory = new RequestFactory();
 }