This is an OAuth2 framework sample app running on iPhone. It uses Cocoapods to install the framework, currently version 2.1. There also is an OS X Test App that does not use CocoaPods.
This example app has you log in to GitHub and then fetches your username and avatar.
Note that there is a "forget tokens" button, which will throw away your current access token, but it will NOT destroy your session with GitHub, so subsequent taps on "Sign In" will briefly show GitHub's login screen which will log you in automatically and disappear immediately. If you use native login (i.e. Safari), you can visit GitHub in Safari and log out there.
There are two buttons, one to login using a built-in web view controller and one to open Safari for login.
This is achieved by setting oauth2.authConfig.authorizeEmbedded
to either true or false.
Refer to the Cocoapods installation guide if you don't yet have it. Then:
git clone https://github.com/p2/OAuth2PodApp.git
cd OAuth2PodApp
pod install
Now you can open OAuth2PodApp.xcworkspace
(not the xcodeproj file) and hit Run.
I have waived all copyright and related or neighboring rights to OAuth2PodApp.