protected override IAsyncResult BeginExecute(NativeActivityContext context, AsyncCallback callback, object state) { string restApiUrl = RestApiUrl.Get(context); if (!restApiUrl.EndsWith("/")) { restApiUrl += "/"; } string client_id = ClientId.Get(context); string client_secret; if (ClientSecretSecure.Get(context) != null) { client_secret = SecureStringToString(ClientSecretSecure.Get(context)); } else { client_secret = ClientSecretInsecure.Get(context); } string redirect_uri = RedirectUrl.Get(context); int serverTimeout = TimeoutMS.Get(context); authAgent = new AuthenticationAgent(restApiUrl, client_id, client_secret, redirect_uri, serverTimeout); authAgent.GetAuthUrl(); ScheduleAuthActivities(context); AuthenticateAsyncDelegate = new Action(AuthenticateAsync); return(AuthenticateAsyncDelegate.BeginInvoke(callback, state)); }
protected override IAsyncResult BeginExecute(NativeActivityContext context, AsyncCallback callback, object state) { string restApiUrl = RestApiUrl.Get(context); if (!restApiUrl.EndsWith("/")) { restApiUrl += "/"; } string client_id = ClientId.Get(context); string client_secret; if (ClientSecretSecure.Get(context) != null) { client_secret = SecureStringToString(ClientSecretSecure.Get(context)); } else { client_secret = ClientSecretInsecure.Get(context); } string redirect_uri = RedirectUrl.Get(context); int serverTimeout = TimeoutMS.Get(context); authAgent = new AuthenticationAgent(restApiUrl, client_id, client_secret, redirect_uri, serverTimeout); if (AuthentificationTokenIn.Get(context) != null) { authAgent.authToken = JsonConvert.DeserializeObject <AuthToken>(AuthentificationTokenIn.Get(context)); authAgent.GetAuthUrl(); authAgent.authCode = JsonConvert.DeserializeObject <ConcurrentDictionary <string, string> >(AuthentificationCodeIn.Get(context)); AuthenticateAsyncDelegate = new Action(ConfigureAuthentification); } else { authAgent.GetAuthUrl(); ScheduleAuthActivities(context); AuthenticateAsyncDelegate = new Action(AuthenticateAsync); } return(AuthenticateAsyncDelegate.BeginInvoke(callback, state)); }