I am having trouble using OAuthSwift with the Dexcom API (https://developer.dexcom.com/authentication) to get the token and then make a request.
Here is the code that I am currently using to authorize the user with the service by clicking a button that links to the sign on and the redirects back.
import UIKit
import OAuthSwift
class ViewController: UIViewController {
// UI Elements
@IBOutlet weak var resultLabel: UILabel!
@IBAction func authorizeTapped(_ sender: Any) {
authorizeDexcom()
}
var oauthswift: OAuth2Swift = OAuth2Swift(
consumerKey: "***",
consumerSecret: "***",
authorizeUrl: "https://sandbox-api.dexcom.com/v2/oauth2/login?",
accessTokenUrl: "https://sandbox-api.dexcom.com/v2/oauth2/token",
responseType: "code"
)
// Dexcom Test Functions
func authorizeDexcom() {
oauthswift.allowMissingStateCheck = true
oauthswift.authorizeURLHandler = SafariURLHandler(viewController: self, oauthSwift: oauthswift)
guard let rdURI = URL(string: "***") else {
return
}
oauthswift.authorize(withCallbackURL: rdURI,
scope: "offline_access",
state: "",
success: { credential, response, parameters in
print("SUCCESS")
print(credential.oauthToken)
}, failure: { error in
print(error.localizedDescription)
}
)
}
Can someone direct me to what my next step should be or how I should go about making requests here? When I run my app and click on the button that calls the authorize function, I get what seems to be a token printed in the console but is followed by a few lines of "get output frames failed, state 8196," which leads me to believe that the authorization process is not finishing correctly.
I have looked at the following resources, but have not found anything helpful yet.
- get output frames failed, state 8196
- I'm testing login authentication in swift using firebase and getting errors get output frames failed, state 8196
- Borring SSl iOS 12
- OAuthSwift (1) connection
Thanks for any help.