Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't auth by api/secret keys (Java app/Android). Key/Secret Pair Failed #32

Closed
ablack13 opened this issue May 20, 2018 · 6 comments
Closed

Comments

@ablack13
Copy link

Hello. Can't authorize by api keys from Coinigy API (My Account -> Coinigy API - >Generate new key ->v1)

Source in Kotlin (but was on Java too. Same result)

`import com.neovisionaries.ws.client.WebSocketException
import com.neovisionaries.ws.client.WebSocketFrame
import io.github.sac.BasicListener
import io.github.sac.ReconnectStrategy
import io.github.sac.Socket
import org.json.JSONObject

class EntryPoint {
companion object {
@JvmStatic
fun main(args: Array) { //entry point
val entryPoint = EntryPoint()
entryPoint.openSocket()
}
}

private val url = "wss://sc-02.coinigy.com/socketcluster/"
private val apiKey = "8a0ab8baf5cb81b78dc5505027876cce"
private val apiSecret = "bd5a3aead6a2fb10756f099a60823d15"

private val socket = Socket(url)

private fun openSocket() {
    with(socket) {
        setListener(object : BasicListener {
            override fun onAuthentication(socket: Socket?, status: Boolean?) {
                val jsonObject = JSONObject()
                jsonObject.put("apiKey", apiKey)
                jsonObject.put("apiSecret", apiSecret)
                socket?.emit("auth", jsonObject, { name, error, data -> System.out.println("name::$name error::$error data::$data") })
            }

            override fun onConnectError(socket: Socket?, exception: WebSocketException?) =
                    System.out.println("Got connect error $exception")

            override fun onSetAuthToken(token: String?, socket: Socket?) =
                    socket!!.setAuthToken(token)

            override fun onConnected(socket: Socket?, headers: MutableMap<String, MutableList<String>>?) =
                    System.out.println("onConnected to end-point")

            override fun onDisconnected(socket: Socket?, serverCloseFrame: WebSocketFrame?, clientCloseFrame: WebSocketFrame?, closedByServer: Boolean) =
                    System.out.println("Disconnected from end-point")
        })
        setReconnection(ReconnectStrategy().setDelay(3000).setMaxAttempts(30))
        connect()
    }
}

}`

Log output:

onConnected to end-point
May 20, 2018 12:17:26 PM io.github.sac.Socket$1 onFrame
INFO: Message :{"data":{"pingTimeout":20000,"id":"iDJKmOeysy60hZkGABuU","isAuthenticated":false},"rid":1}
May 20, 2018 12:17:26 PM io.github.sac.Socket$1 onFrame
INFO: Message :{"data":"Key/Secret Pair Failed","rid":2,"error":{"errorCode":403,"errorMsg":"Key/Secret Pair Failed"}}
name::auth error::{"errorCode":403,"errorMsg":"Key/Secret Pair Failed"} data::Key/Secret Pair Failed

@ablack13
Copy link
Author

image

Sending data is correct, but always return

INFO: Message :{"data":"Key/Secret Pair Failed","rid":2,"error":{"errorCode":403,"errorMsg":"Key/Secret Pair Failed"}}

@sacOO7 please help. 2 days can't connect to Coinigy socket by socketcluster client

@sacOO7
Copy link
Owner

sacOO7 commented May 20, 2018 via email

@sacOO7
Copy link
Owner

sacOO7 commented May 22, 2018

HI @ablack13 , the issue is probably due to coinigy server problem. They have shut it down due to some load balancing issues. You will find more details here Coinigy/api#34

@sacOO7
Copy link
Owner

sacOO7 commented Jul 9, 2018

Hi @ablack13 , I think coinigy websocket api is live now. I will probably write down a code snippet to connect with coinigy server in 1-2 days. Till then, you can enable watch on the repo. 👍

@sacOO7
Copy link
Owner

sacOO7 commented Jul 16, 2018

Hi @ablack13 @aliiizzz I have created a gist to represent code that connects properly to coinigy server. You can find it here https://gist.github.com/sacOO7/a3fc817dfc5c85cf21ec96f09869fdfc

@sacOO7
Copy link
Owner

sacOO7 commented Jul 19, 2018

Hi @ablack13 @aliiizzz , if you don't have any updates in this, I will close the issue .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants