0

I don't know, how to authorize my app to open the tapkey lock.

I have this code, but I dont know what to insert into STRING: userManager.logInAsync(STRING, CancellationTokens.None) Do you have any idea how I can get the User Id or a Token for logging in?

If you need anything of the code just tell me. Thanks for your help!

DasShark
  • 3
  • 1
  • 4

1 Answers1

0

To login into the Tapkey Mobile SDK you need to setup and configure an Identity Provider which signs an JWK Token which has then to be exchanged against an Tapkey Access Token.

Find more detailed here: https://developers.tapkey.io/mobile/authentication/

Detailed informations about using an Identity Provider can be found here: https://developers.tapkey.io/api/authentication/identity_providers/

How to create and register a Identity Provider and a Token Exchange Client can be found here: https://developers.tapkey.io/api/authentication/registration/#identity-provider-registration

1. Sign a JWT Token via trusted services

Sign via a trusted services a JWT Token for your logged in user: https://developers.tapkey.io/api/authentication/identity_providers/

2. Exchange JWT Token with Tapkey Access Token

Exchange the signed JWT Token with an Tapkey Access Token on your devices: https://developers.tapkey.io/api/authentication/token_exchange/

There is no specific implementation for it in the Tapkey Mobile SDK, this has to be done manually.

3. Use the Tapkey Access Token to login

Use the Tapkey Access Token to login into the Tapkey Mobile SDK

userManager.logInAsync([TAPKEY_ACCESS_TOKEN], CancellationTokens.None);

Harald
  • 465
  • 2
  • 8
  • Thank you for your answer, I have tried that, but I just dont get it. I have a Method getToken() with the following Content: https://tiny.rip/6Q1GqiAB1h . And I use it in `userManager.logInAsync(getToken(), CancellationTokens.None);` but I get this error: https://tiny.rip/eeyaN8F8g7 . – DasShark Oct 05 '22 at 12:35
  • Please don't sign production JWT Token directly on the device, as the JWT private key must not be shared with untrusted devices. The signed JWT Token must be exchanged against a Tapkey Access Token. This is missing in your example – Harald Oct 06 '22 at 08:19
  • How can I Exchange the token. Is there any method directly in the SDK or do I need to Code this in any other way? – DasShark Oct 06 '22 at 12:21
  • There is no implementation in the Mobile SDK for that. See updated answer. – Harald Oct 06 '22 at 15:02
  • I now have this code and get this error: https://tiny.rip/vGpXJyfm2c (You can find both in the snippet.) I use the code with my other method: `tokenExchangeManager.exchangeToken(TokenUtil.getToken())`. Any idea why this doesn't work? – DasShark Oct 08 '22 at 08:48
  • This error seems not to be from Tapkey. I guess it is thrown by the used OAuth Library. Which library do you use? – Harald Oct 10 '22 at 08:00
  • I use AppAuth for Android. I guess that's the Name, but it's also linked in the TapKey API Docs Edit: Yes, the Name is AppAuth for Android – DasShark Oct 10 '22 at 13:53
  • Is the ClientId you are using a "Token Exchange Client"? – Harald Oct 10 '22 at 20:50
  • Now I'm using this code: https://tiny.rip/B97ywVDrtn . I figured the problem of the error out by myself. Now I can log in. But do I need in my getToken Method (https://tiny.rip/6Q1GqiAB1h) the IpId or do I need anything else in there? – DasShark Oct 11 '22 at 16:30