auth API experimental
The auth
api module allows you to securely authenticate a Replit user if they use your extension.
Usage
import { experimental } from '@replit/extensions';
const { auth } = experimental;
Methods
auth.getAuthToken
Returns a unique JWT token that can be used to verify that an extension has been loaded on Replit by a particular user
getAuthToken(): Promise<string>
auth.verifyAuthToken
Verifies a provided JWT token and returns the decoded token.
verifyAuthToken(token: string): Promise<{ payload: any, protectedHeader: any }>
auth.authenticate
Performs authentication and returns the user and installation information
authenticate(): Promise<AuthenticateResult>
Types
AuthenticatedUser
Property | Type |
---|---|
id | number |
AuthenticateResult
Property | Type |
---|---|
installation | AuthenticatedInstallation |
user | AuthenticatedUser |