简体   繁体   中英

Github API callback URL

I'm trying to write a github client for iOS in Swift. So far I managed to understand how OAuth 2.0 works. But the thing I don't understand is what callback URL should I enter (for user to be redirected after dealing with OAuth), when registering my app at OAuth applications list. I add URL scheme like "mycustomapp" in Info.plist, then I enter "mycustomapp://" in the callback url field on developer.github website, but it says, that this url is invalid. What URL should I use?

I've managed to find a solution to this issue on a oAuthSwift wiki page. Some API do not accept custom url scheme (ex: myapp://) into callback URL (ex: Linkedin oauth v2, Twitter oauth v1), only http is accepted. So I used a URL with http scheme, which redirects to my custom one. I entered http://oauthswift.herokuapp.com/callback/myappname as a callback and inside my app I redirect to oauth-swift://oauth-callback/myappname Code could be found here https://github.com/dongri/oauthswift.herokuapp.com

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM