Skip to content

crousselle/SwiftOAuth2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SwiftOAuth2

A Swift implementation of OAuth2 for iOS.

#Setup

CROAuth2Client relies on Alamofire, from the excellent Mattt

It is added as a submodule in this repository.

To use correctly CROAuth2Client, please add it as a submodule:

  • Import the library:
git submodule init 
git submodule add git@github.com:crousselle/SwiftOAuth2.git 
// --recursive to get Alamofire
git submodule update --init --recursive
  • Update CRCredentialsHelper with your values

Please follow instructions at https://github.com/Alamofire/Alamofire to set up Alamofire in your project.

#Usage

You first need to create a CROAuth2Client object via the following method:

// From a UIViewController (used to present the authentication webview if necessary)
CROAuth2Client.clientWithPresentingController(self)

Then simply query the access token:

self.client!.retrieveAuthToken({ (authToken) -> Void in
       
        if let authToken = authToken {
            println("Received access token " + authToken)
        }
       
    })

The client will automatically return a valid token from the authentication server, or the keychain.

#Creator Clément Rousselle @clemrousselle

About

A swift implementation of OAuth2

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages