iOS
A mobile app is a frontend client: it gets each user token from your own backend, and never holds your client secret. See Authentication.
Vezgo Connect is compatible with the OAuth 2.0 Authorization Code flow (RFC 6749), so it can be added to a mobile app with readily available OAuth libraries. We recommend AppAuth. The flow is the same on every platform:
- Register a custom-scheme redirect URI for your app, for example
com.yourapp://vezgo. Redirect URIs must be registered with Vezgo. - Get a Vezgo user token from your backend.
- Open the Connect URL as the authorization endpoint, with your client ID, the redirect URI, and the user token as an additional
tokenparameter. Skip the code exchange: there is no token endpoint to call. - When the user finishes, Vezgo redirects back to your app. The authorization
codeit returns is the Vezgo account ID: send it to your backend and store it.
Open Connect
Use AppAuth-iOS, which also covers macOS. Build an OIDAuthorizationRequest against the Connect URL, set as both the authorization and the token endpoint of the OIDServiceConfiguration since AppAuth requires one, and pass the user token in additionalParameters as token. Present it with OIDAuthorizationService.present(_:presenting:callback:), which does not exchange the code, and read the account ID from the response's authorizationCode.