How do I get the user name after finishing the OAuth2 authentication?
--
---
You received this message because you are subscribed to the Google Groups "Freesound API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to freesound-ap...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/freesound-api/c45708ef-1808-40f5-8a37-ad4a95618134n%40googlegroups.com.
func getUserInfo(completion: @escaping (Bool) -> Void) {
let params = UserParams()
let request = HttpRequest(baseUrl: config.meURL,
method: .get,
params: params,
headers: [//"Accept": "application/json",
"Authorization": "Bearer \(authToken)"])
_ = httpClient.performJSONRequest(request: request) { (result: Result<UserModel, HTTPClient.RequestError>) in
switch result {
case .success(let success):
print(success.username)
case .failure(let failure):
print("error \(failure)")
}
}
}
curl -H "Authorization: Bearer <token>" "https://freesound.org/apiv2/me"