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

Invalid MKey signature #5

Closed
burla69 opened this issue Nov 2, 2020 · 10 comments
Closed

Invalid MKey signature #5

burla69 opened this issue Nov 2, 2020 · 10 comments

Comments

@burla69
Copy link

burla69 commented Nov 2, 2020

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
Copy link
Collaborator

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
Copy link
Author

burla69 commented Nov 2, 2020

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
Copy link
Author

burla69 commented Nov 2, 2020

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

@jakov-clay
Copy link
Collaborator

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
Copy link
Collaborator

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

@burla69
Copy link
Author

burla69 commented Nov 2, 2020

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.

  • we update certificates every time when i want to open lock.

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

@jakov-clay
Copy link
Collaborator

jakov-clay commented Nov 2, 2020

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
Copy link
Author

burla69 commented Nov 2, 2020

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
Copy link
Author

burla69 commented Nov 2, 2020

Thank you!)

@jakov-clay
Copy link
Collaborator

You'r welcome! 👍

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