cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Latest Sinch iOS SDK + a legacy VOIP account

Blazej
Occasional Contributor

Can I use the latest iOS SDK (SinchRTC 5.11.6) with the "Legacy Voice, Video, and Verification" service?

 

I'm in a process of updating our iOS app from SinchRTC 4.2.11 SDK and while implementing the new JSON Web Token authentication process I hit a wall. I think I'm creating the JWTs correctly, but I'm always getting 401 errors from `clientDidFail(_: SINClient!, error: Error!)` delegate method:

 

 

Error Domain=SINErrorDomainApi Code=401 "401 (401)" UserInfo={NSLocalizedDescription=401 (401), serverReference=f32fc19e-2801-406f-8116-671cc1262720, serverMessage=401, httpStatusCode=401, ocraErrorCode=401}

 

 

I'm afraid this might be caused by our account being still a legacy one, it's registered at pawel.dudek@toptal.com

 

1 ACCEPTED SOLUTION

Accepted Solutions

Andreas_Svitzer
Employee
Employee

The information you provide above shows the following error in our logs:
Authentication failure: IDX10501: Signature validation failed. Unable to match key: kid: 'System.String'.


Within our iOS distribution you will find our Swift sample app, dynamic/SinchRTC/samples/VideoCallKitSwift:
https://download.sinch.com/ios/5.12.5/SinchRTC-iOS-5.12.5%2b6f51d567.tar.bz2

There you will find an example for how to create the JWT with Swift and you can also run the sample to verify you credentials. 

Andreas Svitzer, Tech Lead Manager

View solution in original post

6 REPLIES 6

Andreas_Svitzer
Employee
Employee

Hi Blazej,

 

You should be able to use the same credentials you used with the legacy SDK.

Here are some additional documentation for creating and signing your JWT:
https://github.com/sinch/sinch-rtc-api-auth-examples
https://developers.sinch.com/docs/in-app-calling/ios/auth/
https://developers.sinch.com/docs/in-app-calling/ios-android-cloud-migration/

Let me know if you still have issues after looking through the docs.

 

Andreas Svitzer, Tech Lead Manager

Blazej
Occasional Contributor

Hi Andreas,

I've looked into your Python example and I think I'm doing exactly the same, just in Swift. Perhaps I'm using wrong backend address. It used to be `sandbox.sinch.com` for debugging and `clientapi.sinch.com` for production. At the moment I'm only testing a debugging build against `ocra.api.sinch.com`, is this fine?

 

Also, the error I get is not very descriptive but maybe you could check your server logs and tell me what's wrong with my JWT? My app ID is `f4016904-df1d-4ffb-ad3a-95e525e9e13a` and here is exactly the error code I'm getting:

 

 

{
	"error": {
		"code": 401,
		"message": "401",
		"reference": "127e6693-b7f4-457d-99dc-f81c43f93c9a"
	}
}

 

 

Blazej
Occasional Contributor

I just used a sniffer to intercept the JWT that goes to your servers and verified with jwt.io that it looks as expected (at least AFAIU) and is correctly signed. Here it is: https://jwt.io/#debugger-io?token=eyJraWQiOiJoa2RmdjEtMjAyMjA4MTAiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiIvL...

Andreas_Svitzer
Employee
Employee

The information you provide above shows the following error in our logs:
Authentication failure: IDX10501: Signature validation failed. Unable to match key: kid: 'System.String'.


Within our iOS distribution you will find our Swift sample app, dynamic/SinchRTC/samples/VideoCallKitSwift:
https://download.sinch.com/ios/5.12.5/SinchRTC-iOS-5.12.5%2b6f51d567.tar.bz2

There you will find an example for how to create the JWT with Swift and you can also run the sample to verify you credentials. 

Andreas Svitzer, Tech Lead Manager

Blazej
Occasional Contributor

Hi Andreas, thank you! Your sample Swift code indeed is able to authenticate against `ocra.api.sinch.com`. I tested both tokens with jwt.io and they have the same content, so I don't really get where's the difference. Anyway, I'll just continue using your sample. Thank you!

Andreas_Svitzer
Employee
Employee

Great stuff, let me know if you need something else 

Andreas Svitzer, Tech Lead Manager