Server libraries
An Upollo server library can be used identify users before they login, or if they visit from multiple devices.
The library runs on your server, and can be paired with a client library for web and mobile to protect logins and payments.
Availability
Upollo's server libraries are available for the following environments and languages:
- Go: Available via
go get github.com/upollo/userwatch-go
- NodeJS: Available on NPM via
npm install --save @upollo/node
- Python: Available via
pip install upollo-python
Get your API Keys
Sign up at app.upollo.ai/login to get your Private API key.
API
The Upollo
server API is outlined below. The details of the
request and response protocol buffers are documented in
upollo/userwatch-shepherd.
- Go
- NodeJS
- Python
// To use:
// import upollo "github.com/upollo/userwatch-go"
// client, err := upollo.NewClientBuilder(PRIVATE_API_KEY).Build()
package upollo
// An instance of ShepherdClient is used to access Upollo functionality.
// It is recommended to create and reuse a single instance. You will not
// typically need to specify any options.
func NewClientBuilder(publicApiKey string) *ClientOptions {}
func (*ClientOptions) Build() (ShepherdClient, error)
type ShepherdClient interface {
// Inform Upollo of an event in your application.
//
// Include any UserInfo you have in the TrackEventRequest, or an empty
// UserInfo if you have none.
Track(
ctx context.Context,
in *upollo.TrackEventRequest,
) *upollo.AnalysisResponse
// Access the assessment of a user for whom an event was previously
// registered with Upollo via a track(EventType, UserInfo) call from
// your client application.
//
// At this point you can also attach any additional UserInfo your server
// has which your client might not have had available.
Verify(
ctx context.Context,
in *upollo.VerifyRequest,
) *upollo.AnalysisResponse
// You can challenge the user for more identifying information. You can
// use either a phone SMS code, a WebAuthn login (like a fingerprint reader)
// or one you have built yourself which you verify.
CreateChallenge(
ctx context.Context,
in *upollo.CreateChallengeRequest,
) *upollo.CreateChallengeResponse
// You can verify the result of the challenge by passing a challenge verification
// request.
VerifyChallenge(
ctx context.Context,
in *upollo.ChallengeVerificationRequest
) (*upollo.ChallengeVerificationResponse, error)
}
// To use:
// import { Upollo } from "@upollo/node";
// const upolloClient = new Upollo("your-private-api_key");
export class Upollo {
// Accepts the project's private api key and an optional options object.
// 'options' can contain an optional 'url' to override the upollo api.
constructor(privateApiKey: string, options?: { url?: string });
// To verify a user you need a token from a web or mobile client library.
// You can also provide user info such as user id, email or phone number
// as a userInfo object to improve detection. If you don't have that info
// provide an empty userInfo.
verify(
eventToken: String,
userInfo?: uwproto_UserInfo,
challengeVerification?: uwproto_ChallengeVerificationRequest
): Promise<uwproto_AnalysisResponse>
// You can challenge the user for more identifying information. You can
// use either a phone SMS code, a WebAuthn login (like a fingerprint reader)
// or one you have built yourself which you verify. You can verify a challenge
// by doing another verify call providing a uwproto_ChallengeVerificationRequest
// to the VerifyRequest.
createChallenge(
type: uwproto_CreateChallengeType,
userinfo: uwproto_UserInfo,
deviceId: String,
origin: string
): Promise<uwproto_CreateChallengeResponse>
}
// To use:
// from upollo import upollo
// from upollo import upollo_public_pb2
// upolloClient = upollo.Upollo(privateApiKey)
class Upollo:
def __init__(self, privateApiKey):
// To verify a user you need a token from a web or mobile client library.
// You can also provide user info such as user id, email or phone number
// as a userInfo object to improve detection. If you don't have that info
// provide an empty userInfo.
def verify(self,
upolloToken: str,
userInfo: upollo_public_pb2.UserInfo
) -> upollo_public_pb2.AnalysisResponse:
// You can challenge the user for more identifying information. You can
// use either a phone SMS code, a WebAuthn login (like a fingerprint reader)
// or one you have built yourself which you verify.
def createChallenge(self
challengeType: upollo_public_pb2.ChallengeType,
userInfo: upollo_public_pb2.UserInfo,
deviceId: str
) -> upollo.upollo_shepherd_pb2.CreateChallengeResponse:
// You can verify the result of the challenge by passing a challenge verification
// request.
def verifyChallenge(
self,
type: upollo_public_pb2.ChallengeType,
userInfo: upollo_public_pb2.UserInfo,
deviceId: str,
challengeId: str,
secretResponse: upollo.upollo_shepherd_pb2.ChallengeVerificationRequest
) -> upollo.upollo_shepherd_pb2.ChallengeVerificationResponse