public async Task <IActionResult> AuthCallback(string code, string state) { if (code._IsEmpty() || state._IsEmpty()) { throw new ApplicationException($"この URL は認証サービスからのコールバック専用です。直接アクセスすることはできません。"); } string id = state; InboxAdapter adapter = Reader.GetAdapter(id); InboxAdapterUserCredential credential = await adapter.AuthGetCredentialAsync(code, this.GenerateAbsoluteUrl(nameof(AuthCallback))); adapter.Start(credential); Reader.SaveSettingsFile(); return(Redirect("/")); }
protected override void StartImpl(InboxAdapterUserCredential credential) { if (credential == null) { throw new ArgumentNullException("credential"); } if (Started.IsFirstCall()) { this.UserCredential = credential; this.Api = new SlackApi("", "", this.AppCredential.ClientSecret); } else { throw new ApplicationException("Already started."); } }
protected override void StartImpl(InboxAdapterUserCredential credential) { if (credential == null) { throw new ArgumentNullException("credential"); } if (Started.IsFirstCall()) { this.UserCredential = credential; this.Api = new GoogleApi(this.AppCredential.ClientId._NullCheck(), this.AppCredential.ClientSecret._NullCheck(), this.UserCredential.AccessToken); } else { throw new ApplicationException("Already started."); } }