The AFXAuthClient is a client library for authenticating with the AFX API. It provides an easy-to-use interface for handling authentication for your web or mobile applications. With AFXAuthClient, you can easily authorize API requests and retrieve access tokens.


  1. Install the AFXAuthClient library using CocoaPods by adding the following line to your Podfile:

pod ‘AFXAuthClient’

  1. Update your dependencies by running the following command in your terminal:

pod install


Step 1: Import

In the file where you want to authenticate with the AFX API, import the AFXAuthClient module:

import AFXAuthClient

Step 2: Set up client

Create an instance of AFXAuthClient and configure it with your client ID, client secret, and redirect URI:

let authClient = AFXAuthClient(clientID: “YOUR_CLIENT_ID”, clientSecret: “YOUR_CLIENT_SECRET”, redirectURI: “YOUR_REDIRECT_URI”)

Step 3: Authenticate

Use the authenticate method to initiate the authentication process:

authClient.authenticate(scope: [.profile, .email]) { result in
switch result {
case .success(let token):
// Authentication successful, access token retrieved
print(“Access Token: \(token.accessToken)”)
print(“Expiration Date: \(token.expirationDate)”)
case .failure(let error):
// Authentication failed, handle error
print(“Authentication Failed: \(error.localizedDescription)”)

Step 4: Handle redirect URI

In your AppDelegate’s application(_:open:options:) method, handle the redirect URI:

func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
if authClient.isRedirectURL(url) {
return true
return false

Step 5: Make authenticated requests

Once authenticated, you can use the access token to authorize API requests. Here’s an example using Alamofire:

AF.request(“”, headers: [“Authorization”: “Bearer \(authClient.accessToken)”]).response { response in
// Handle response

Additional Information

API Documentation

For detailed information about the AFXAuthClient library, including all available methods and properties, refer to the API documentation.

Sample Code

Explore the GitHub repository for sample code and usage examples.


For any issues or questions, please visit the support page or contact our support team at


The AFXAuthClient library is released under the MIT License.