Authentication
Overview
After the SDK is initialized, you need to login to the Pango platform to be able to start VPN. Available login options may depend on the platform setup for your organization.
Pango Authentication
Pango Auth provides managed user authentication without requiring you to deploy and maintain your own OAuth server.
Benefits of Pango Auth:
No need to deploy or maintain your own authentication server
Managed user creation and authentication handled by Pango
Simple token-based integration with the VPN SDK
Supports access token refresh for seamless user sessions
Steps to implement Pango Auth:
Obtain your Project ID and API credentials from the Pango Developer Console.
Create users via the Pango Auth API (typically done on your backend server).
Sign in users to obtain access tokens (can be done client-side with Public API key).
Use the access token with
AuthMethod.pango(accessToken)to login to the VPN SDK.
See the platform-specific tabs below for code examples.
Platform Implementation
Pango Authentication Example
Use the access token obtained from Pango Auth to login to the VPN SDK.
Token Considerations
When you login with token, you don't need to refresh it, it can be re-used. However it can be invalidated for some reason (login with same device id...etc).
In case you receive one of following errors:
PartnerAPI.APIError.notAuthorized- The token of user is invalid/expired.PartnerAPI.APIError.unauthorized- This user is unauthorized or login operation is still pending.
then you need to initiate login again, and call SDK login(method: AuthMethod, completion: @escaping UserCompletion) again with new token.
References
For more information on authentication methods, please refer to the AuthMethod reference documentation.
Last updated
Was this helpful?