Extra Horizon
GitHub
  • Extra Horizon Documentation
  • Getting Started
    • Start familiarizing yourself
  • Tutorials
    • Medical Device Tutorial
      • Preparation
      • Build your first prototype
        • Define a data model
        • Configure your workflows
          • Workflow 1: Analyze a measurement
          • Workflow 2: Create & store a PDF report
          • Workflow 3: Send an e-mail
        • Define your permissions
          • Update your schema with user permissions
          • Update your schema with group permissions
        • Build the Front-End
          • Set up oAuth in your backend
          • Demo login page
      • Summary & Wrap up
    • Polysomnography (PSG) Tutorial
    • Retool - Building dashboards Tutorial
  • FAQ
    • General
  • Services
    • Identity and Access Management
      • User service
        • Users
        • Groups
        • Global roles
        • Configuration
      • Auth Service
        • Applications
        • OAuth2
        • OAuth1
        • MFA
        • OpenID Connect
          • Google Cloud
          • Azure ADFS
    • Data Management
      • File Service
      • Data Service
        • Schemas
        • Documents
        • FAQ Data Service
    • Automation
      • Task Service
        • Functions
        • Tasks
        • API Functions
        • Examples
          • Hello world (JS)
          • Hello world (Py)
          • Hello world (Docker)
        • FAQ
      • Dispatchers Service
      • Event Service
        • System Events
    • Communication
      • Notification Service
        • Notifications
        • Settings
      • Mail Service
    • Other
      • Localization Service
        • Language Codes
      • Template Service
        • Localizations
      • Payments Service
        • Subscriptions
        • Stripe
        • iOS App Store
      • Configurations Service
  • API Reference
    • OpenAPI Specifications
    • 📦Changelog
      • Per-service Changelog
    • Postman Reference Collection
  • Tools
    • SDK
    • CLI
    • Control Center
  • Additional Resources
    • Resource Query Language (RQL)
    • Handling Errors
    • GitHub
    • API interaction (Python)
    • Migration guide: Enabling verification request limiting
  • ExH Platform
    • 🙋Support
    • ⏱️Usage and Performance
    • 🔓Security
    • 🗺️Regions
    • ⚖️Cloud Subscription Agreement
    • 🇺🇸CFR 21 Part 11
Powered by GitBook
On this page
  • Grants
  • Password grant
  • Mfa Grant
  • SSO Token Grant
  • Tokens
  • Retrieve a list of active tokens
  • Revoking tokens
  • SSO
  • Generate SSO Tokens

Was this helpful?

  1. Services
  2. Identity and Access Management
  3. Auth Service

OAuth1

PreviousOAuth2NextMFA

Last updated 27 days ago

Was this helpful?

Grants

Password grant

The Password Grant accepts your username and password, then returns an Access Token and a Refresh token. As mentioned before the Access Token can be used to authenticate API requests.

See also the for more information about the password format and login attempts.

await exh.auth.authenticate({
    email:'john.doe@example.com',
    password:'myPassword1234'
});

Note that in case this user has MFA enabled this function will throw a MfaRequiredError. With the information in the error you can follow the to complete the authentication.

Mfa Grant

When MFA is enabled for a user and you try to authenticate using the password grant you will receive a MfaRequiredError . You can catch the error and use the Mfa Grant to complete the authentication.

try {
  await exh.auth.authenticate({
    password: '',
    email: '',
  });
} catch (error) {
  if (error instanceof MfaRequiredError) {
    const { mfa } = error.response;

    // Your logic to request which method the user want to use in case of multiple methods
    const methodId = mfa.methods[0].id;

    await exh.auth.confirmMfa({
      token: mfa.token,
      methodId,
      code: '', // code from ie. Google Authenticator
    });
  }
  // handle other possible authentication errors
}

SSO Token Grant

You can exchange an SSO token generated by application for access tokens that can be used by another application. This way you can implement a single sign one flow between e.g. mobile and web.

This functional is currently not supported by Javascript SDK. You can use the raw method of the SDK to access this functionality.

await exh.raw.post('/auth/v2/oauth1/ssoTokens/consume',{
    ssoToken: "{ssoTokenHere}"
});

Tokens

Retrieve a list of active tokens

This functional is currently not supported by Javascript SDK. You can use the raw method of the SDK to access this functionality.

await exh.raw.get('/auth/v2/oauth1/tokens');

Revoking tokens

This functional is currently not supported by Javascript SDK. You can use the raw method of the SDK to access this functionality.

await exh.raw.delete('/auth/v2/oauth1/tokens/{tokenId}');

SSO

Generate SSO Tokens

You can create a single use SSO token. Another client can consume such a token and exchange it for an authorization.

This functional is currently not supported by Javascript SDK. You can use the raw method of the SDK to access this functionality.

await exh.raw.post('/auth/v2/oauth1/ssoTokens/generate');
Mfa Grant
Password Policy User Service setting