Refreshing token in extension app

Please include the following information in your post:

  • Which SDK this is regarding: e.g. auth0-swift
  • SDK Version: e.g. 1.30.1
  • Platform Version: e.g. iOS 13

Basically, I am trying to use Auth0 in my app’s Share Extension. I was able to get Auth0 to be recognized by the extension however I am having hard time refreshing the token.
So I know that the token (or the credentials object) gets saved in the main app’s keychain container however this container - to my knowledge - is not accessible by extensions. I am only able to access the token via a different shared container (UserDefaults or Keychain) but this process has to happen in the container app rather than the extension.

So my question is, is there a way for me to refresh the token (in my app it seems that this has to happen every 24 hours) in the extension app without going back to the container app?

Thanks!

Probably too late to be useful for the OP, but:

This should be possible by explicitly passing a CredentialsStorage argument that writes to the shared keychain instead of relying on the default CredentialsStorage, which does not specify an access group and instead uses to the app’s default access group (unaccessible to any other app/extension).

Luckily, the currently used CredentialsStorage is SimpleKeychain, which offers this type of configurability out of the box. Untested code, but it should be as simple as:

import SimpleKeychain
let credentialsManager = CredentialsManager(authentication: Auth0.authentication(),
                                            storage: SimpleKeychain(accessGroup: "ABCDEFGH.com.example.myaccessgroup"))```

If you configure both apps to use that same access group, you should be able --as an example-- to use the refresh token saved from `app1` to acquire a new access token from `app2` , because both apps are using the same keychain.

See also [this github issue](https://github.com/auth0/Auth0.swift/issues/214).