Code Monkey home page Code Monkey logo

Comments (16)

joelmm1 avatar joelmm1 commented on July 25, 2024 1

by using the browser

from iqoptionapi.

MadOne199 avatar MadOne199 commented on July 25, 2024 1

This is in Java code, but quite clear and working.
The initial login is via a https post. the cookie ssid is used to keep the login alive, then we upgrade our https connection to a wss connection.
The following relates to the https URL's.
// precedes a comment in java. ; ends the code to run/line

// List of url's in use
private static final String url = "https://iqoption.com";  // base site
private static final String urlLogin = url + "/api/login";  // use https POST to login
private static final String urlGetProfile = url + "/api/getprofile";  // use https GET 
private static final String urlChangeBalance = url + "/api/profile/changebalance";  // use https GET

when using this python coded api, use-

api = IQOptionAPI("iqoption.com", "yourLoginEmail", "yourPassword")
api.connect()

from iqoptionapi.

Olascoaga avatar Olascoaga commented on July 25, 2024

At 18:07 GMT the api works well

from iqoptionapi.

frxncisjoseph avatar frxncisjoseph commented on July 25, 2024

The login endpoint for the website is https://auth.iqoption.com/api/v1.0/login.
I haven't used nor worked on this API in a long time so I'm not sure.

Are you receiving a 404 error visiting it in a browser or through the API wrapper?

from iqoptionapi.

RickyGlobal9 avatar RickyGlobal9 commented on July 25, 2024

Hey @MadOne199 , i just converted your source to c#

`
HttpWebRequest request = WebRequest.Create("https://iqoption.com/api/login") as HttpWebRequest;
request.Method = "POST";

            string _auth = string.Format("{0}:{1}", "[email protected]", "mydemopass");
            string _enc = Convert.ToBase64String(Encoding.ASCII.GetBytes(_auth));
            string _cred = string.Format("{0} {1}", "Basic", _enc);
            request.Headers[HttpRequestHeader.Authorization] = _cred;
            request.ContentType = "application/json";

            var httpResponse = (HttpWebResponse)request.GetResponse();
            using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
            {
                var result = streamReader.ReadToEnd();
                Response.Write(result);
            }

`

But it returns
{"isSuccessful":false,"message":{"email":["E-mail "" is not valid"],"password":["Invalid password length"]},"result":[]}

Can you please help me why this response returns?

from iqoptionapi.

MadOne199 avatar MadOne199 commented on July 25, 2024

Can’t help with C# sorry. Never used it. The response indicates you are not using your real login email and password so check that first. I am of course assuming you have an account. I also don’t see where the post is being made ie iqoption.com or eu.iqoption.com? The fact that you have a response shows that you are nearly there. Not at a computer so sorry cannot be more helpful.

from iqoptionapi.

MadOne199 avatar MadOne199 commented on July 25, 2024

I read it all this time, I cannot see anything obvious and cannot try the code just now.
1/. The response says email and password incorrect. Check these values by a manual login via a web browser
2/ you are using http biut the site is https.

I know it may sound daft, but I had similar response and it was down to me using an incorrect password.
Please note that I only used this code to see how to do it. I don’t use the python code.

If still stuck at the weekend ask again and I will try to help

from iqoptionapi.

keinbuck avatar keinbuck commented on July 25, 2024

Did you already solve the problem? I have the same issue and don't know why...
@MadOne199 I tried to login manually --> works fine and http or https does not change the problem...

from iqoptionapi.

Ravenglass avatar Ravenglass commented on July 25, 2024

@HubSpace2000 Thats the default response if the post data is missing from the request.

@MadOne199 @SiliconDare You don't need to use the Authorization Header, you're not requesting a network authorization. Your content type is also wrong. Post the email address and password in the request stream. The following should work fine. Cheers!

HttpWebRequest HTTPRequest = WebRequest.Create("https://iqoption.com/api/login") as HttpWebRequest;

var PostData = Encoding.ASCII.GetBytes("[email protected]&password=eXaMpL3");

HTTPRequest.Method = "POST";
HTTPRequest.ContentType = "application/x-www-form-urlencoded";
HTTPRequest.ContentLength = PostData.Length;

using (var HTTPStream = HTTPRequest.GetRequestStream())
{
    HTTPStream.Write(PostData, 0, PostData.Length);
}

var HTTPResponse = (HttpWebResponse)HTTPRequest.GetResponse();

using (var HTTPResponseStream = new StreamReader(HTTPResponse.GetResponseStream()))
{
    var HTTPResponseString = HTTPResponseStream.ReadToEnd();
    MessageBox.Show(HTTPResponseString);
}

@n1nj4z33 I think this issue can be closed now?

from iqoptionapi.

RickyGlobal9 avatar RickyGlobal9 commented on July 25, 2024

@HubSpace2000 Thats the default response if the post data is missing from the request.

@MadOne199 @SiliconDare You don't need to use the Authorization Header, you're not requesting a network authorization. Your content type is also wrong. Post the email address and password in the request stream. The following should work fine. Cheers!

HttpWebRequest HTTPRequest = WebRequest.Create("https://iqoption.com/api/login") as HttpWebRequest;

var PostData = Encoding.ASCII.GetBytes("[email protected]&password=eXaMpL3");

HTTPRequest.Method = "POST";
HTTPRequest.ContentType = "application/x-www-form-urlencoded";
HTTPRequest.ContentLength = PostData.Length;

using (var HTTPStream = HTTPRequest.GetRequestStream())
{
    HTTPStream.Write(PostData, 0, PostData.Length);
}

var HTTPResponse = (HttpWebResponse)HTTPRequest.GetResponse();

using (var HTTPResponseStream = new StreamReader(HTTPResponse.GetResponseStream()))
{
    var HTTPResponseString = HTTPResponseStream.ReadToEnd();
    MessageBox.Show(HTTPResponseString);
}

@n1nj4z33 I think this issue can be closed now?

I needed to change the login url to the updated v1.0 and is working fine
It returns a session id something like this {"data":{"ssid":"90ab03c2e4ee732b3581ca9420f09c99"}}

But after this response how to get profile. The success url to retrieve profile is https://iqoption.com/api/getprofile but it returns {"isSuccessful":false,"message":"Not logged in","result":[]}

from iqoptionapi.

Ravenglass avatar Ravenglass commented on July 25, 2024

It’s been an year since I tried this, but from what I remember I was using the above code with a Cookie Container and WebSocket requests. Did you try the above code? What was in the JSON result?

from iqoptionapi.

RickyGlobal9 avatar RickyGlobal9 commented on July 25, 2024

It’s been an year since I tried this, but from what I remember I was using the above code with a Cookie Container and WebSocket requests. Did you try the above code? What was in the JSON result?

I already mentioned above that the login works fine and returns a ssid but having problem to get profile

from iqoptionapi.

MightyMaxSaviorOfTheUniverse avatar MightyMaxSaviorOfTheUniverse commented on July 25, 2024

How do you find all these urls?

from iqoptionapi.

fpinheiro82 avatar fpinheiro82 commented on July 25, 2024

@HubSpace2000 Thats the default response if the post data is missing from the request.

@MadOne199 @SiliconDare You don't need to use the Authorization Header, you're not requesting a network authorization. Your content type is also wrong. Post the email address and password in the request stream. The following should work fine. Cheers!

HttpWebRequest HTTPRequest = WebRequest.Create("https://iqoption.com/api/login") as HttpWebRequest;

var PostData = Encoding.ASCII.GetBytes("[email protected]&password=eXaMpL3");

HTTPRequest.Method = "POST";
HTTPRequest.ContentType = "application/x-www-form-urlencoded";
HTTPRequest.ContentLength = PostData.Length;

using (var HTTPStream = HTTPRequest.GetRequestStream())
{
    HTTPStream.Write(PostData, 0, PostData.Length);
}

var HTTPResponse = (HttpWebResponse)HTTPRequest.GetResponse();

using (var HTTPResponseStream = new StreamReader(HTTPResponse.GetResponseStream()))
{
    var HTTPResponseString = HTTPResponseStream.ReadToEnd();
    MessageBox.Show(HTTPResponseString);
}

@n1nj4z33 I think this issue can be closed now?

hi, someone can help me? Hi, i have tried this code but i couldn't make it work.
i am receiving a 404 error! I have tryed two URLs: https://iqoption.com/api/v1.0/login and https://iqoption.com/api/login.

from iqoptionapi.

fpinheiro82 avatar fpinheiro82 commented on July 25, 2024

ok. i got it! the correct url is "https://auth.iqoption.com/api/v1.0/login"

from iqoptionapi.

victorratts13 avatar victorratts13 commented on July 25, 2024

thanks

from iqoptionapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.