TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Jun 2017 |
SwiftSwift Version | 2.3 |
SPMSupports SPM | ✗ |
Maintained by ricohapi.
This open-source library allows you to integrate Ricoh API's Authorization and Discovery Service into your Swift app.
Learn more at http://docs.ricohapi.com/
You'll also need
If you don't have them, please register yourself and your client from THETA Developers Website.
This section shows you two different methods to install Ricoh Auth Client for Swift in your application.
See Auth Sample to try out a sample of Ricoh Auth Client for Swift.
$ git clone https://github.com/ricohapi/auth-swift.git
Open the new auth-swift
directory, and drag RicohAPIAuth.xcodeproj
into the Project Navigator of your application's Xcode project.
It should appear nested underneath your application's blue project icon. Whether it is above or below all the other Xcode groups does not matter.
Choose RicohAPIAuth scheme at the scheme menu of Xcode and run it.
Choose your application scheme and run it to load the RicohAPIAuth module.
Install completed! See Sample Flow for a coding example.
// Import
import RicohAPIAuth
// Set your Ricoh API Client Credentials
var authClient = AuthClient(
clientId: "<your_client_id>",
clientSecret: "<your_client_secret>"
)
// Set your Ricoh ID
authClient.setResourceOwnerCreds(
userId: "<your_user_id>",
userPass: "<your_password>"
)
// Open a new session
authClient.session(){result, error in
if !error.isEmpty() {
print("status code: \(error.statusCode)")
print("error message: \(error.message)")
} else {
print("access token : \(result.accessToken)")
}
var authClient = AuthClient(
clientId: "<your_client_id>",
clientSecret: "<your_client_secret>"
)
authClient.setResourceOwnerCreds(
userId: "<your_user_id>",
userPass: "<your_password>"
)
authClient.session(){result, error in
if error.isEmpty() {
print("access token : \(result.accessToken)")
// do something
}
// This method resumes a preceding session if it is closed.
authClient.getAccessToken(){result, error in
if error.isEmpty() {
print("access token : \(result.accessToken)")
// do something
}