Comments (7)
Oh man, this is a year ago. Where did the pool go?
from aws-mobile-appsync-sdk-ios.
Hello @alionthego
Thanks for reporting this. I will put together example and update this thead.
Thanks,
Rohan
from aws-mobile-appsync-sdk-ios.
@alionthego Sorry for the delayed response. Here is the snippet you need:
import AWSAppSync
class MyCognitoUserPoolsAuthProvider: AWSCognitoUserPoolsAuthProvider {
func getLatestAuthToken() -> String {
var token: String? = nil
pool.currentUser()?.getSession().continueOnSuccessWith(block: { (task) -> Any? in
token = task.result!.idToken!.tokenString
return nil
}).waitUntilFinished()
return token!
}
}
// You can choose your database location, accessible by the SDK
let databaseURL = URL(fileURLWithPath:NSTemporaryDirectory()).appendingPathComponent(database_name)
do {
// Initialize the AWS AppSync configuration
let appSyncConfig = try AWSAppSyncClientConfiguration(url: "endpoint-url",
serviceRegion: "region",
userPoolsAuthProvider: MyCognitoUserPoolsAuthProvider(),
databaseURL: databaseURL)
// Initialize the AWS AppSync client
appSyncClient = try AWSAppSyncClient(appSyncConfig: appSyncConfig)
} catch {
print("Error initializing appsync client. \(error)")
}
from aws-mobile-appsync-sdk-ios.
This feature has been added with SDK version 2.6.20
+
from aws-mobile-appsync-sdk-ios.
@alionthego Sorry for the delayed response. Here is the snippet you need:
import AWSAppSync class MyCognitoUserPoolsAuthProvider: AWSCognitoUserPoolsAuthProvider { func getLatestAuthToken() -> String { var token: String? = nil pool.currentUser()?.getSession().continueOnSuccessWith(block: { (task) -> Any? in token = task.result!.idToken!.tokenString return nil }).waitUntilFinished() return token! } }
Where is pool
coming from? It's undefined.
Using AWSAuthCore (2.6.18)
Using AWSAuthUI (2.6.18)
Using AWSCognitoIdentityProvider (2.6.18)
Using AWSCognitoIdentityProviderASF (1.0.1)
Using AWSCore (2.6.18)
Using AWSMobileClient (2.6.18)
PODS:
- AWSAppSync (2.6.23):
- AWSCore (~> 2.6.6)
- ReachabilitySwift (~> 4.0.0)
- SQLite.swift (= 0.11.4)
- AWSAuthCore (2.6.18):
- AWSCore (= 2.6.18)
- AWSAuthUI (2.6.18):
- AWSAuthCore (= 2.6.18)
- AWSCore (= 2.6.18)
- AWSCognitoIdentityProvider (2.6.18):
- AWSCognitoIdentityProviderASF (= 1.0.1)
- AWSCore (= 2.6.18)
- AWSCognitoIdentityProviderASF (1.0.1)
- AWSCore (2.6.18)
- AWSMobileClient (2.6.18):
- AWSAuthCore (= 2.6.18)
- AWSUserPoolsSignIn (2.6.18):
- AWSAuthCore (= 2.6.18)
- AWSCognitoIdentityProvider (= 2.6.18)
- ReachabilitySwift (4.0.0)
- SQLite.swift (0.11.4):
- SQLite.swift/standard (= 0.11.4)
- SQLite.swift/standard (0.11.4)
from aws-mobile-appsync-sdk-ios.
It worked after updating all dependencies.
from aws-mobile-appsync-sdk-ios.
@kadishmal How did you solve the pool
undefined issue ?
from aws-mobile-appsync-sdk-ios.
Related Issues (20)
- Memory leak in AppSyncRealtimeClient HOT 2
- AWSNetworkTransport Error when initializing AWSAppSync in AppDelegateFile SwiftUI - Xcode 13.1 HOT 4
- Add support for Custom Domain Names for AWS AppSync APIs HOT 8
- AWS AppSync SDK with AppSync APIs v2 protocol (pure WebSockets) HOT 1
- AWSAppSyncClient: AWSPerformMutationQueue Crash HOT 2
- Crash: AWSAppSyncClient.sync HOT 5
- Removing pods from source control HOT 2
- AWSMobileClient Crash when app starts HOT 3
- Completion Handler on AWSAppSyncClient.perform called more than once. HOT 1
- Enabling retry for custom scenarios HOT 1
- Update SQLite dependency to match Amplify.DataStore's SQLite version
- Make public constructor for GraphQLError HOT 2
- SPM dependency conflict with Amplify library HOT 6
- Using AWSAppSync with Amplify DataStore HOT 5
- App crashes: AWSAppSync $s10AWSAppSync36AWSCognitoUserPoolsAuthProviderAsyncPAAE09getLatestF5TokenSSyF HOT 1
- SPM dependency resolution failure using aws-mobile-appsync-sdk-ios 3.6.2 and amplify-swift 2.6.0 HOT 2
- AWS subscriptions - subscribe function is not thread safe and causes crashes HOT 1
- Version incompability with other amplify packages HOT 2
- Unknow TCP connection process keep running even when all subscriptions are unsubscribed HOT 1
- How to avoid duplicate mutations when the app is backgrounded/quit before the mutation is finished? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aws-mobile-appsync-sdk-ios.