oauth2 authentication not working in iPhone

Hello All,
I am developing one iPhone app in which I need to implement login with hubspot.
To implement this, I used oauth2 library in swift. In this I am using below code to do authorization.
When I run the app, its navigating me to safari and asking to enter id and passwrod of Hubspot. When I enter it, its just keep me inside the website and showing 3 dots loading. Please check this screenshot for the same: https://tinyurl.com/y3trpphr

func getAccess()
{
let oauthswift = OAuth2Swift(
consumerKey: “****”,
consumerSecret: “****”,
authorizeUrl: “https://app.hubspot.com/oauth/authorize”,
accessTokenUrl: “https://api.hubapi.com/oauth/v1/token”,
responseType : “code”
)
oauthswift.authorize(withCallbackURL: URL(string: “myapp://”), scope: “contacts”, state:“code”, success: { (credentials, response, parameters) in
print(response as Any)
}, failure: { (error) in
print(error)
})
}

Hi, @manish6415.

Apologies for the delayed response. I believe we missed this post last week because it posted on a different forum and moved here.

The behavior you describe sounds similar to these reports. Can you ensure that your authorization URL’s scope and redirect_uri parameters are properly encoded?

Also, to clarify, the OAuth process described here is used to connect HubSpot developer applications to production accounts.

This process is not a HubSpot login flow.

Users will only need to complete the flow once unless they disconnect your app from their account. For more information on OAuth, check out these FAQs.

If I’ve misunderstood your goal, please let me know.