Skip to main content
Request user authorization and get an authorization code for backend token exchange.

Parameters

PropertyTypeRequiredDescription
scopesArrayYesAuthorization scopes to request (e.g., ['auth_user'])
successFunctionNoCallback with auth code
failFunctionNoCallback on failure
completeFunctionNoCallback that always executes

Success Callback

PropertyTypeDescription
authCodeStringShort-lived authorization code
authSuccessScopesArraySuccessfully authorized scopes

Code Example

my.getAuthCode({
  scopes: ['auth_user'],
  success: (res) => {
    console.log('Auth code:', res.authCode);
    // Send to backend for token exchange
    this.sendToBackend(res.authCode);
  },
  fail: (err) => {
    console.error('Authorization failed:', err);
  }
});
The authCode is short-lived and single-use. It must be exchanged server-side via the Rebell OpenAPI for a user context. Never validate the authCode client-side.

my.getOpenUserInfo

Get user information

Backend Authentication

Auth code exchange guide