Authing DocsDocuments
Concept
workflow
Guides
Development Integration
Application integration
Concept
workflow
Guides
Development Integration
Application integration
Old Version
Development Integration
  • Single Sign-On (SSO)
  • Login component

  • JavaScript/Node.js

  • Java / Kotlin

  • Python

  • C#

  • PHP

  • Go

  • Ruby
  • Android

  • iOS

  • Flutter

    • Quick start
    • APIs

      • Authentication
      • OIDC
      • MFA
      • Scan to login
    • Social login
    • On-premise
  • React Native
  • WeChat Mini Program
  • WeChat webpage authorization
  • Framework Integration
  • Error code
  1. Development Integration
  2. /
  3. Flutter
  4. /
  5. APIs
  6. /
  7. OIDC

¶ OIDC API

Update Time: 2026-03-25 09:13:34
Edit

¶ Auth by code

After OIDC authentication, we will get an authorization code. Use this API to get user's access token & id token. Note that since we are front end, we cannot set OIDC client secret, instead, we have to use PKCE to get the code.

static Future<AuthResult> authByCode(String code, String codeVerifier, String redirectUrl) async

params

  • code authorization code
  • codeVerifier PKCE code verifier
  • redirectUrl a valid url set in Authing console

example

AuthResult result = await AuthClient.authByCode("P6FENDfGSH72PxgJQk17FoGMWY3oL1G0D2PQ1AfyDeo",
        "fu6IivbcEb7DFCytjLmoAICRtFLbG9zkk5QdDbNd0gG",
        "https://guard.authing/redirect");
String ak = result.user?.accessToken;
String idToken = result.user?.token;

¶ Use email and password registration

Use the email registration, the mailbox is not case sensitive and the only userpool is unique. This interface does not require the user to verify the mailbox, after the user registration, the emailVerified field will be false.

static Future<AuthResult> registerByEmail(String email, String password) async

Parameter

  • email email address
  • password password

example

AuthResult result = await OIDCClient.registerByEmail("email", "password");
User user = result.user; // get user info

Error Code

  • 2003 Illegal email address
  • 2026 Registered mailbox

¶ Register using username

Use the username to register, the username is case sensitive and the only user pool.

static Future<AuthResult> registerByUserName(String username, String password) async

Parameter

  • username username
  • password password

Example

AuthResult result = await OIDCClient.registerByUserName("username", "password");
User user = result.user; // get user info

Error Code

  • 2026 Registered mailbox

¶ Use mobile phone number registration

Use your mobile phone number to register, you can set the initial password of the account at the same time. You can pass sendSmsCode method sends SMS verification code.

  static Future<AuthResult> registerByPhoneCode(String phone, String code, String password) async

Parameter

  • phone The phone number
  • code SMS verification code
  • password initial password, it can be null

Example

AuthResult result = await OIDCClient.registerByPhoneCode("phone", "code", "password");
User user = result.user; // get user info

Error Code

  • 2001 SMS verification code error
  • 2026 Cell phone number registered

¶ OIDC Login by account and password

static Future<AuthResult> loginByAccount(String account, String password) async

params

  • account can be one of the following: phone number / email / user name
  • password clear text password

example

AuthResult results = await OIDCClient.loginByAccount("your account", "your password");
User user = result.user; // user info

¶ OIDC Login by phone code

login by phone number and a verification code. Must call sendSms method to get an SMS verification code before calling this method.

static Future<AuthResult> loginByPhoneCode(String phone, String code) async

params

  • phone phone number
  • code SMS code

example

AuthResult result = await OIDCClient.loginByPhoneCode("phone", "code");
User user = result.user; // get user info

¶ Build authorize URL

The buildAuthorizeUrl method can be used to build the login URL, load the URL in your WebView.

static Future<AuthResult> buildAuthorizeUrl(AuthRequest authRequest) async

params

  • authRequest Sets the custom parameters.Valid parameters include 'scope','redirectUrl','state'.For a detailed list, check the AuthRequest().

example

AuthRequest authRequest = AuthRequest();
authRequest.createAuthRequest();
// authRequest.scope = "scope";
// authRequest.redirectUrl = "redirectUrl";
String url = await OIDCClient.buildAuthorizeUrl(authRequest);

¶ Token Change user information

Use Access token to get user information.

static Future<AuthResult> getUserInfoByAccessToken(String accessToken, [Map? data]) async 

params

  • accessToken Access token

example

AuthResult result = await OIDCClient.getUserInfoByAccessToken("accessToken");
User user = result.user; // get user info

¶ Refresh Access Token

Get new Access Token with Refresh token.

static Future<AuthResult> getNewAccessTokenByRefreshToken(String refreshToken) async 

params

  • refreshToken Refresh Token

example

AuthResult result = await OIDCClient.getNewAccessTokenByRefreshToken("refreshToken");
User user = result.user; // get user info

Prev: Authentication Next: MFA
  • Auth by code
  • OIDC Login by account and password
  • OIDC Login by phone code
  • Build authorize URL
  • Token Change user information
  • Refresh Access Token

User identity management

Integrated third-party login
Mobile phone number flash check (opens new window)
Universal login form component
Custom authentication process

Enterprise internal management

Single Sign On
Multi-factor Authentication
Authority Management

Developers

Development Document
Framework Integration
Blog (opens new window)
GitHub (opens new window)
Community User Center (opens new window)

Company

400 888 2106
sales@authing.cn
16 / F, Block B, NORTH STAR CENTURY CENTER, Beijing(Total)
room 406, 4th floor, zone B, building 1, No. 200, Tianfu Fifth Street, Chengdu(branch)

Beijing ICP No.19051205-1

© Beijing Steamory Technology Co.