Authentication
The VPN SDK for Apple requires authentication before establishing a VPN connection. This article covers common authentication methods supported by the SDK.
OAuth Authentication
OAuth is a popular authentication protocol that allows users to grant limited access to their resources on one site to another site, without sharing their credentials. To use OAuth with the VPN SDK:
In the example above:
Obtain an OAuth access token from your OAuth provider. This typically involves presenting an OAuth dialog to the user to authorize your application.
Create an instance of
AuthMethod
with the.oauth
type and provide the OAuth access token.Call the
login
function of the SDK, passing theauthMethod
object.
The completion handler will be called with an error
parameter and a user
object. If the login is successful, error
will be nil
, and you can handle the authenticated user
object. If the login fails, error
will contain the error details.
Anonymous Authentication
For scenarios where user-specific authentication is not required, the SDK also supports anonymous login:
With anonymous login, no credentials are needed.
References
Last updated
Was this helpful?