ClaySolutions / ClaySDK

This SDK for iOS contains the most up-to-date frameworks for integrating Mobile Key technology into your own iOS applications.
https://saltoks.com/developers/connect/mobile-sdk-introduction/
MIT License
1 stars 1 forks source link

Invalid MKey signature #5

Closed burla69 closed 4 years ago

burla69 commented 4 years ago

Hello. When i use "accept" api key i can open all my doors. When i want to use "develop" or "production" api can I always get an error: "Invalid MKey signature". How can i solve this?

let clay = ClaySDK(installationUID: "36bffba2-00f6-4bf7-8f83-c1a8543*****", apiKey: "MFkwEwYHKoZIzj0CAQYIK*****", delegate: self)

        let publicKey = clay.getPublicKey()

        accountService.load(service: .mobileKey(publicKey: publicKey), decodeType: String.self) { (result) in
            switch result {
            case .success(let code):
                print(code)
                clay.openDoor(with: code, delegate: self)
            case .failure(let error):
                print(error)
            }
        }
jakov-clay commented 4 years ago

You are probably using always the same mkey activated on one of the environments and then it doesn't work on other. When switching environment you need to activate mkey via API for that environment.

burla69 commented 4 years ago

Every time i use new mkey. But have Invalid MKey signature error We use this API to activate mkey: /v1.1/me/devices/{id}/mkey

burla69 commented 4 years ago

Maybe you have some sample example projects where i can check implementation

jakov-clay commented 4 years ago

Hmmm, then maybe you use wrong api public key. Be sure that you are using correct api public key. Mentioned endpoint is only to fetch mkey for device. Before that you need to execute PUT request to update certificate.

jakov-clay commented 4 years ago

I do not have example project. Did you get document which describes mobile key activation?

burla69 commented 4 years ago

I do not have example project. Did you get document which describes mobile key activation?

Yes. I have documents on dropbox. And i use right api key.

But it works only when i put ACCEPT api key. With this api key i can open all my locks

jakov-clay commented 4 years ago

It should work then. Maybe you missed something else. Are you sure you are also switching API url for each environment? Maybe you are activating always on Accept?

burla69 commented 4 years ago

ohhhhh, i seeeeee. Problem in url... we use https://clp-**accept**-user.my-clay.com/v1.1/me/devices/{id}/mkey Sorry. Will check again

burla69 commented 4 years ago

Thank you!)

jakov-clay commented 4 years ago

You'r welcome! 👍