Skip to content

Instantly share code, notes, and snippets.

@nparsons08

nparsons08/Account.swift Secret

Created May 4, 2020
Embed
What would you like to do?
// ios/TheStream/Account.swift:130
private func setupChat() {
Alamofire
.request("\(apiRoot)/v1/stream-chat-credentials",
method: .post,
headers: ["Authorization" : "Bearer \(authToken!)"])
.responseJSON { [weak self] response in
print(response)
let body = response.value as! NSDictionary
let chatToken = body["token"]! as! String
let apiKey = body["apiKey"] as! String
if let user = self?.user {
StreamChatClient.Client.config = .init(apiKey: apiKey, logOptions: .info)
StreamChatClient.Client.shared.set(
user: StreamChatClient.User(id: user),
token: chatToken
)
self?.isAuthed = true
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.