iosswiftamazon-cognitosiriappintents

How do I pass auth tokens to an IOS shortcut?


I'm using the App Intents framework to create a shortcut that captures data from a user and posts it to a web service. Is there any documentation or advice about the best way to handle the authentications tokens that the web service requires? I'm using Cognito as the auth service.

I need the user to register via an app and get a user ID, access token and refresh token from the service, then pass that to the shortcut somehow so that they can post data. Any guidance about the best way to do this would be amazing.


Solution

  • In the AppIntents framework, your shortcut's code runs in the same container as the main app. Once you authenticate in the main app, you can save data to the filesystem, keychain, UserDefaults, or any other place you store persistent data in a normal app.