Natural Language ProcessingNatural Language Processing

Compute
Elastic Cloud Server
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
Domain Name Service
VPC Endpoint
Cloud Connect
Enterprise Switch
Security & Compliance
Anti-DDoS
Web Application Firewall
Host Security Service
Data Encryption Workshop
Database Security Service
Advanced Anti-DDoS
Data Security Center
Container Guard Service
Situation Awareness
Managed Threat Detection
Compass
Cloud Certificate Manager
Anti-DDoS Service
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GaussDB NoSQL
GaussDB(for MySQL)
Distributed Database Middleware
GaussDB(for openGauss)
Developer Services
ServiceStage
Distributed Cache Service
Simple Message Notification
Application Performance Management
Application Operations Management
Blockchain
API Gateway
Cloud Performance Test Service
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
DevCloud
ProjectMan
CodeHub
CloudRelease
CloudPipeline
CloudBuild
CloudDeploy
Cloud Communications
Message & SMS
Cloud Ecosystem
Marketplace
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP License Service
Support Plans
Customer Operation Capabilities
Partner Support Plans
Professional Services
enterprise-collaboration
Meeting
IoT
IoT
Intelligent EdgeFabric
DeveloperTools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Help Center> Natural Language Processing> FAQs> How Do I Obtain a User Token Using Postman?
Updated at: Feb 22, 2022 GMT+08:00

How Do I Obtain a User Token Using Postman?

Postman is a visual editing tool for building and testing API requests. It provides an easy-to-use user interface to send HTTP requests, including GET, PUT, POST, and DELETE requests. Postman allows you to modify parameters of HTTP requests and returns response to your requests.

A token is a user's access credential, which includes user identities and permissions. When you call an API to access cloud resources, a token is required for identity authentication.

Perform the procedure described in this section to obtain a user token using Postman. For details about the parameters, see Obtaining a User Token.

Prerequisites

You have installed and registered with Postman.

Procedure

  1. Edit the request URL, header, and body of the API used to obtain a token for calling APIs.

    • Request URL
      The request URL is in the format https://IAM region and endpoint/API URI.
      1. Obtain the IAM region and endpoint from Regions and Endpoints.
        Currently, NLP Fundamentals, language generation, language understanding, and machine translation APIs are available in the CN North-Beijing4 region.
        Figure 1 IAM regions and endpoints

      2. Obtain the API URI from Obtaining a User Token.

        For example, the request URL in the ap-southeast-3 region is https://iam.ap-southeast-3.myhwclouds.com/v3/auth/tokens.

      3. Select an API request method and enter the request URL in Postman.
    • Request Header

      Set key to Content-Type and value to application/json;charset=utf8.

    • Request Body
      Modify parameters in the example request body.
      {
      	"auth": {
      		"identity": {
      			"methods": [
                                      "password"
                               ],
      			"password": {
      				"user": {
      					"domain": {
      						"name": "Account name"
      					},
      					"name": "IAM user name",
      					"password": "IAM user password"
      				}
      			}
      		},
      		"scope": {
      			"domain": {
      						"name": "Account name"
      			}
      		}
      	}
        }

  2. Click Send to send the API request.

  3. View the token in the response header. When you call other IAM APIs, you can use this token for authentication.

    • The validity period of a token is 24 hours. If you want to use a token for authentication, cache it to avoid frequently calling the IAM API.
    • If an error code, for example 401, is returned, the authentication fails. Confirm that parameters in the request body are correct and send the request again.
    • If "Header Overflow" is displayed, resolve the problem by referring to Solution.

Solution

We have found that Postman of V7.25.0, V7.26.0, or later cannot be used to obtain a user token due to configurations. The message "Header Overflow" will be displayed if you use any of these versions.

  • Method 1

    Use an earlier version of Postman, such as V5.xx.

  • Method 2:

    Run the following curl command to obtain a token and replace the text in bold with actual values:

    curl -ik -X POST -H 'Content-Type=application/json;charset=utf8' -d '{"auth": {"identity": {"methods": ["password"],"password": {"user": {"domain": {"name": "Account name"},"name": "IAM user name","password": "IAM user password"}},},"scope": {"domain": {"name": "Account name"}}}}' https://iam.ap-southeast-1.myhuaweicloud.com/v3/auth/tokens
  • Method 3

    Pass an additional environment variable NODE_OPTIONS=--max-http-header-size=16384 (16KB) to Postman to specify the maximum size of the HTTP header (in bytes).

    Run one of the following commands depending on your OS:

    • macOS
      NODE_OPTIONS=--max-http-header-size=16384 /Applications/Postman.app/Contents/MacOS/Postman 
    • Linux
      NODE_OPTIONS=--max-http-header-size=16384 /path/to/Postman/Postman 
    • Windows
      set NODE_OPTIONS=--max-http-header-size=16384 
      C:\users\<username>\AppData\local\Postman\Postman.exe

Did you find this page helpful?

Failed to submit the feedback. Please try again later.

Which of the following issues have you encountered?







Please complete at least one feedback item.

Content most length 200 character

Content is empty.

OK Cancel