ios - Intercept oauth2 callback -


i'm trying connect ios swift app api, , i've experimented oauthswift, aerogear, , heimdallr.

the flow working fine, api doesn't have user-owned resources. users have access resources. api does, however, require oauth2 authenticate.

is there way prevent swift app bouncing safari (or safariwebview) , either avoiding user login part or handling workaround? know sort of antithetical oauth2, there's no need (and impediment) single user logged in api.

basically, want app login on backend access every user. know api has sdk's in ruby, python, , node that. so, how can in swift?

here's oauthswift code gets me in:

let yourendpoint = ("https://www.awebsite.com/search/shows/a_show")     let oauthswift = oauth2swift(         consumerkey: "my key",         consumersecret: "my secret",         authorizeurl: "https://www.awebsite.com/oauth/authorize",         accesstokenurl: "https://www.awebsite.com/oauth/token",         responsetype: "token")          let name = "sample_api_proj"       oauthswift.authorizewithcallbackurl( nsurl(string: "xxx:xxxx:xx:oauth:2.0:xxx")!, scope: "", state: "", success: {         credential, response, parameters in         self.showtokenalert(name, credential: credential)          let parameters =  dictionary<string, anyobject>()         oauthswift.client.get("https://www.awebsite.com/api/search/shows/ashow", parameters: parameters,             success: {                 data, response in                 let jsondict: anyobject! = try? nsjsonserialization.jsonobjectwithdata(data, options: [])                 print(jsondict)             }, failure: { error in                 print(error)         })         }, failure: { error in             print(error.localizeddescription)     }) 

i'm returning provide answer found. didn't realize there different types of oauth2, , type used authorize entire app called 'client credentials.' not libraries/pods designed type of oauth. working solution found p2.oauth2.


Comments