-
Notifications
You must be signed in to change notification settings - Fork 202
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
Add a method to retrieve the device key for the currently logged-in device. #3394
Comments
Hi @sungwonshinn, thanks for opening this issue. The team will take a look and post here once we have an update. |
This has been identified as a feature request. If this feature is important to you, we strongly encourage you to give a 👍 reaction on the request. This helps us prioritize new features most important to you. Thank you! |
@sungwonshinn This is something that is not supported in Amplify and is an internal implementation detail. Could you share a more detailed example of how Amplify and |
@harsh62 We use app group with shared keychain items to pass user name and password. Then our app extension and Siri extension use the user credential to log in with InitiateAuth. This works fairly well, but when MFA is enabled, app extension and Siri extension can't respond to the MFA auth challenge during signin with user name and password. |
As I said earlier, device key is something that is not exposed using any of the Amplify API's. If #2508 ends up getting implemented, you should then just be able to do |
@harsh62 I'm not sure #2508 will help my use case fully. Also, device key was available via AwsMobileClient.deviceOperations.get() in the previous releases. I think the device key info should not be encapsulated from the API users because the current AuthDevice in Amplify does not expose enough information such as device attributes. To get that, Cognito GetDevice API with device key via the escape hatch has to be used to get the device attributes. So, #2508 won't help in that scenario. |
If Amplify starts supporting App Groups, it will allow session sharing between extensions. Thereby not needing to call
Since this was something that was available with escape hatch in Amplify V1, I will talk internally with the team to possibly add this capability in Amplify V2.
To get more details about Cognito devices, you would need to cast
When you use I hope my answers provide more clarity. |
@harsh62 Thank you for the detailed answer. I really appreciate that you are looking into this.
Thank you. I hope this gets implemented.
I didn't know about AWSAuthDevice. It's more useful than AuthDevice. The Auth.fetchDevices seems to return only the remembered devices but tracked and not-remembered devices are not included. So, I wouldn't necessarily find which one is the current device even if I have the device key when I'm going to iterate the devices.
No I don't have the key. That's why I requested for making the device key available. |
Is your feature request related to a problem? Please describe.
Currently, there seems no way to get the device key for the currently logged-in device. I believe this was available from the
Describe the solution you'd like
Under Auth, implement currentDeviceId or currentDeviceKey property to return the current device id or key.
Describe alternatives you've considered
If there is a way to retrieve this via Cognito API, but I wasn't able to find this. Amplify Auth.fetchDevices seems to fetch only the trusted devices. The non-trusted tracked devices do not get listed.
Also, Hub sign-in event's payload doesn't seem to have event data attached.
Is the feature request related to any of the existing Amplify categories?
Auth
Additional context
We use InitiateAuth from the app extension and Siri to login like this:
The refresh token and device key is shared via app group registry by the main iPhone app.
The text was updated successfully, but these errors were encountered: