Automated login from C# Using Post in WPF
I've been trying to write an app to use OAUTH method with pInterest to Upload new pins automatically and have been trying to find the best way of doing this.
So Far i've got a working example going where in my WPF app in C# i can get the login details using a RestAPI Get Method to get the login URL for the pInterest user and once logged it my app will hit tab twice then enter to give permission from pInterest.
The Method i've got working involves -
- Using .NET 4.6.2 or later getting WebView UI WPF controls from nuget
- Using RestAPI Get Method to get the URL of the app accept page
- Using the output of step 2 in a webview component to let IE login and display the App Accept Page ( IE having username / password set up already)
- OnNavigateComplete once the URL has "/api.pinterest.com/oauth" using SendKeys.SendWait from Winforms to send Tab, Tab , Enter
- Once Navigate completes grab the URL if its got "state" & "code" in the URL then close the form.
I'm looking to see if there is a better way of doing this i've tried CefSharp but the GetAuthorizeCreditials does not fire off when i implement my own IResponseHandler as its a Post Submit button and i've tried to use javascript code from C# passed in via cefSharp but i couldnt get it to work
c# cefsharp pinterest
|
show 2 more comments
I've been trying to write an app to use OAUTH method with pInterest to Upload new pins automatically and have been trying to find the best way of doing this.
So Far i've got a working example going where in my WPF app in C# i can get the login details using a RestAPI Get Method to get the login URL for the pInterest user and once logged it my app will hit tab twice then enter to give permission from pInterest.
The Method i've got working involves -
- Using .NET 4.6.2 or later getting WebView UI WPF controls from nuget
- Using RestAPI Get Method to get the URL of the app accept page
- Using the output of step 2 in a webview component to let IE login and display the App Accept Page ( IE having username / password set up already)
- OnNavigateComplete once the URL has "/api.pinterest.com/oauth" using SendKeys.SendWait from Winforms to send Tab, Tab , Enter
- Once Navigate completes grab the URL if its got "state" & "code" in the URL then close the form.
I'm looking to see if there is a better way of doing this i've tried CefSharp but the GetAuthorizeCreditials does not fire off when i implement my own IResponseHandler as its a Post Submit button and i've tried to use javascript code from C# passed in via cefSharp but i couldnt get it to work
c# cefsharp pinterest
Please update your question to include which version ofCefSharp
you are using and show the code you've tried that is not working.GetAuthCredentials
is only called when a page requests auth at the network layer, http basic auth, proxy auth, ftp auth etc.
– amaitland
Nov 19 '18 at 3:04
WPF V69 , the page is the login page for pInterest
– Justin Smyth
Nov 20 '18 at 8:24
I know nothing aboutpintrest
. Please post the code you've tried already.
– amaitland
Nov 20 '18 at 8:26
MyChromeWebBrowser = new ChromiumWebBrowser(); MainGrid.Children.Add(MyChromeWebBrowser); MyChromeWebBrowser.RequestHandler = new MyResponseHandler("*****@?????.net", "*****"); MyChromeWebBrowser.IsBrowserInitializedChanged += OnIsBrowserInitializedChanged;
– Justin Smyth
Nov 20 '18 at 8:26
this never fires. - > public bool GetAuthCredentials(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame, bool isProxy, string host, int port, string realm, string scheme, IAuthCallback callback) { callback.Continue(user, pass); return true; }
– Justin Smyth
Nov 20 '18 at 8:26
|
show 2 more comments
I've been trying to write an app to use OAUTH method with pInterest to Upload new pins automatically and have been trying to find the best way of doing this.
So Far i've got a working example going where in my WPF app in C# i can get the login details using a RestAPI Get Method to get the login URL for the pInterest user and once logged it my app will hit tab twice then enter to give permission from pInterest.
The Method i've got working involves -
- Using .NET 4.6.2 or later getting WebView UI WPF controls from nuget
- Using RestAPI Get Method to get the URL of the app accept page
- Using the output of step 2 in a webview component to let IE login and display the App Accept Page ( IE having username / password set up already)
- OnNavigateComplete once the URL has "/api.pinterest.com/oauth" using SendKeys.SendWait from Winforms to send Tab, Tab , Enter
- Once Navigate completes grab the URL if its got "state" & "code" in the URL then close the form.
I'm looking to see if there is a better way of doing this i've tried CefSharp but the GetAuthorizeCreditials does not fire off when i implement my own IResponseHandler as its a Post Submit button and i've tried to use javascript code from C# passed in via cefSharp but i couldnt get it to work
c# cefsharp pinterest
I've been trying to write an app to use OAUTH method with pInterest to Upload new pins automatically and have been trying to find the best way of doing this.
So Far i've got a working example going where in my WPF app in C# i can get the login details using a RestAPI Get Method to get the login URL for the pInterest user and once logged it my app will hit tab twice then enter to give permission from pInterest.
The Method i've got working involves -
- Using .NET 4.6.2 or later getting WebView UI WPF controls from nuget
- Using RestAPI Get Method to get the URL of the app accept page
- Using the output of step 2 in a webview component to let IE login and display the App Accept Page ( IE having username / password set up already)
- OnNavigateComplete once the URL has "/api.pinterest.com/oauth" using SendKeys.SendWait from Winforms to send Tab, Tab , Enter
- Once Navigate completes grab the URL if its got "state" & "code" in the URL then close the form.
I'm looking to see if there is a better way of doing this i've tried CefSharp but the GetAuthorizeCreditials does not fire off when i implement my own IResponseHandler as its a Post Submit button and i've tried to use javascript code from C# passed in via cefSharp but i couldnt get it to work
c# cefsharp pinterest
c# cefsharp pinterest
asked Nov 18 '18 at 8:14
Justin SmythJustin Smyth
1
1
Please update your question to include which version ofCefSharp
you are using and show the code you've tried that is not working.GetAuthCredentials
is only called when a page requests auth at the network layer, http basic auth, proxy auth, ftp auth etc.
– amaitland
Nov 19 '18 at 3:04
WPF V69 , the page is the login page for pInterest
– Justin Smyth
Nov 20 '18 at 8:24
I know nothing aboutpintrest
. Please post the code you've tried already.
– amaitland
Nov 20 '18 at 8:26
MyChromeWebBrowser = new ChromiumWebBrowser(); MainGrid.Children.Add(MyChromeWebBrowser); MyChromeWebBrowser.RequestHandler = new MyResponseHandler("*****@?????.net", "*****"); MyChromeWebBrowser.IsBrowserInitializedChanged += OnIsBrowserInitializedChanged;
– Justin Smyth
Nov 20 '18 at 8:26
this never fires. - > public bool GetAuthCredentials(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame, bool isProxy, string host, int port, string realm, string scheme, IAuthCallback callback) { callback.Continue(user, pass); return true; }
– Justin Smyth
Nov 20 '18 at 8:26
|
show 2 more comments
Please update your question to include which version ofCefSharp
you are using and show the code you've tried that is not working.GetAuthCredentials
is only called when a page requests auth at the network layer, http basic auth, proxy auth, ftp auth etc.
– amaitland
Nov 19 '18 at 3:04
WPF V69 , the page is the login page for pInterest
– Justin Smyth
Nov 20 '18 at 8:24
I know nothing aboutpintrest
. Please post the code you've tried already.
– amaitland
Nov 20 '18 at 8:26
MyChromeWebBrowser = new ChromiumWebBrowser(); MainGrid.Children.Add(MyChromeWebBrowser); MyChromeWebBrowser.RequestHandler = new MyResponseHandler("*****@?????.net", "*****"); MyChromeWebBrowser.IsBrowserInitializedChanged += OnIsBrowserInitializedChanged;
– Justin Smyth
Nov 20 '18 at 8:26
this never fires. - > public bool GetAuthCredentials(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame, bool isProxy, string host, int port, string realm, string scheme, IAuthCallback callback) { callback.Continue(user, pass); return true; }
– Justin Smyth
Nov 20 '18 at 8:26
Please update your question to include which version of
CefSharp
you are using and show the code you've tried that is not working. GetAuthCredentials
is only called when a page requests auth at the network layer, http basic auth, proxy auth, ftp auth etc.– amaitland
Nov 19 '18 at 3:04
Please update your question to include which version of
CefSharp
you are using and show the code you've tried that is not working. GetAuthCredentials
is only called when a page requests auth at the network layer, http basic auth, proxy auth, ftp auth etc.– amaitland
Nov 19 '18 at 3:04
WPF V69 , the page is the login page for pInterest
– Justin Smyth
Nov 20 '18 at 8:24
WPF V69 , the page is the login page for pInterest
– Justin Smyth
Nov 20 '18 at 8:24
I know nothing about
pintrest
. Please post the code you've tried already.– amaitland
Nov 20 '18 at 8:26
I know nothing about
pintrest
. Please post the code you've tried already.– amaitland
Nov 20 '18 at 8:26
MyChromeWebBrowser = new ChromiumWebBrowser(); MainGrid.Children.Add(MyChromeWebBrowser); MyChromeWebBrowser.RequestHandler = new MyResponseHandler("*****@?????.net", "*****"); MyChromeWebBrowser.IsBrowserInitializedChanged += OnIsBrowserInitializedChanged;
– Justin Smyth
Nov 20 '18 at 8:26
MyChromeWebBrowser = new ChromiumWebBrowser(); MainGrid.Children.Add(MyChromeWebBrowser); MyChromeWebBrowser.RequestHandler = new MyResponseHandler("*****@?????.net", "*****"); MyChromeWebBrowser.IsBrowserInitializedChanged += OnIsBrowserInitializedChanged;
– Justin Smyth
Nov 20 '18 at 8:26
this never fires. - > public bool GetAuthCredentials(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame, bool isProxy, string host, int port, string realm, string scheme, IAuthCallback callback) { callback.Continue(user, pass); return true; }
– Justin Smyth
Nov 20 '18 at 8:26
this never fires. - > public bool GetAuthCredentials(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame, bool isProxy, string host, int port, string realm, string scheme, IAuthCallback callback) { callback.Continue(user, pass); return true; }
– Justin Smyth
Nov 20 '18 at 8:26
|
show 2 more comments
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53359020%2fautomated-login-from-c-sharp-using-post-in-wpf%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53359020%2fautomated-login-from-c-sharp-using-post-in-wpf%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Please update your question to include which version of
CefSharp
you are using and show the code you've tried that is not working.GetAuthCredentials
is only called when a page requests auth at the network layer, http basic auth, proxy auth, ftp auth etc.– amaitland
Nov 19 '18 at 3:04
WPF V69 , the page is the login page for pInterest
– Justin Smyth
Nov 20 '18 at 8:24
I know nothing about
pintrest
. Please post the code you've tried already.– amaitland
Nov 20 '18 at 8:26
MyChromeWebBrowser = new ChromiumWebBrowser(); MainGrid.Children.Add(MyChromeWebBrowser); MyChromeWebBrowser.RequestHandler = new MyResponseHandler("*****@?????.net", "*****"); MyChromeWebBrowser.IsBrowserInitializedChanged += OnIsBrowserInitializedChanged;
– Justin Smyth
Nov 20 '18 at 8:26
this never fires. - > public bool GetAuthCredentials(IWebBrowser chromiumWebBrowser, IBrowser browser, IFrame frame, bool isProxy, string host, int port, string realm, string scheme, IAuthCallback callback) { callback.Continue(user, pass); return true; }
– Justin Smyth
Nov 20 '18 at 8:26