Authentication

The SDK supports multiple authentication methods to ensure secure and flexible access for users.

OAuth Authentication

The Pango Partner VPN Backend supports OAuth authentication with a partner's OAuth server, which is the main method for authenticating users. Here are the steps to implement OAuth:

Prerequisites

  • Access to an OAuth service that can be accessed over the Internet.

  • OAuth credentials (client ID and client secret) for your service.

  1. Set Up OAuth Service

    1. Deploy and configure your OAuth service so it can be accessed over the Internet.

    2. Obtain your OAuth credentials, such as the client ID and client secret.

  2. Configure the Partner Backend

    1. Set up the Pango Partner VPN Backend to use your OAuth service.

    2. Provide the required OAuth details, including:

      1. OAuth server URL

      2. Client ID

      3. Client secret

  3. Implement OAuth in Your Client Application

    1. In your Android app, implement the OAuth flow to authenticate users and obtain access tokens.

    2. Use the appropriate OAuth libraries or SDKs for Android to handle the authentication process.

  4. Retrieve the Access Token

    1. After a successful authentication, retrieve the access token from the OAuth server.

    2. This token will be used to initialize and log in to the Android Partner SDK.

  5. Initialize the Android Partner SDK

    1. Use the obtained access token to log into the Android Partner SDK.

    2. Here's an example of how to initialize the SDK with the access token:

UnifiedSdk sdk = UnifiedSdk.getInstance();

AuthMethod authMethod = AuthMethod.customOauth("YOUR_OAUTH_TOKEN");
sdk.getBackend().login(authMethod, new Callback<User>() {
   @Override
   public void success(User response) {
       // Handle successful login
       // For example: update UI, save user info, etc.
   }
   @Override
   public void failure(VpnException error) {
       // Handle login failure
       // For example: show error message, retry login, etc.
   }
});

List of Authentication Methods

  • Pango Authentication

  • Firebase - AuthMethod.firebase(token): Authenticates using a Firebase token. Should be configured when creating the app. This is a service from Google and you can learn more about it here.

  • OAuth - AuthMethod.customOauth(token): Authenticates using a specific OAuth type. Should be configured when creating the app.

  • Anonymous - AuthMethod.anonymous(): This method is no longer supported.

Last updated