AWS ExpiredTokenException after app relaunch

后端 未结 2 1292
暗喜
暗喜 2021-01-21 15:39

I\'m building an iOS (Swift) app using AWS as the backend with Developer Authenticated Identities. Everything works fine until I close the app, leave it for a while and then rel

2条回答
  •  [愿得一人]
    2021-01-21 16:46

    The AWS Mobile SDK for iOS 2.4.x has a new protocol called AWSIdentityProviderManager. It has the following method:

    /**
     * Each entry in logins represents a single login with an identity provider.
     * The key is the domain of the login provider (e.g. 'graph.facebook.com') and the value is the
     * OAuth/OpenId Connect token that results from an authentication with that login provider.
     */
    - (AWSTask *> *)logins;
    

    The responsibility of an object conforming to this protocol is to return a valid logins dictionary whenever it is requested. Because this method is asynchronous, you can make networking calls in it if the cached token is expired. The implementation is up to you, but in many cases, AWSIdentityProviderManager manages multiple AWSIdentityProviders, aggregates them and return the logins dictionary.

提交回复
热议问题