Token is a core function that authenticates either rep or customer credentials and provides an OAuth token for use when calling other functions on their behalf. Calls to this function should use no-auth.
When authenticating a rep or customer, a prefix is used for the username to deliniate the context of the request between either rep authentication or customer authentication. The prefix is checked in the response username as well. The function does not automatically determine if the credentials are for a rep or for a customer. This function is not used to generate an OAuth token for an API User Account.
A token can also be provided by the WebAPI functions for Single Signon.
If a rep or customer changes their password, prior OAuth Tokens will be expired.
Verb/URI: POST /Client/token
POST /token
{
"grant_type":"password",
"username":"-->r_1001",
"password":"examplepassword",
"client_id":"ByDesignAngularJSShoppingCart"
}
POST /token
{
"grant_type":"password",
"username":"-->c_1146820",
"password":"ExamplePassword123@",
"client_id":"ByDesignAngularJSShoppingCart"
}
Token and Token Expiration Data
Rep or Customer Information
StatusCode: 200 (Ok) - Rep Authentication
{
"access_token":"Vi3ng2sc5gw7X7PL4PZ1Ln9AeMrwnPATu_PwKHWhcZpsCXDq1f6SdEMHu_Q4YxzJHLvsUcqzgQVhno5ywGxUBzvFqEcpRVaAXCncaZvPRQ8C7WVM-7hztdwO9bNGkSP8ByH4UGd4KVl6tIZ8HmnM2D5example8s5i5X68R_ICcKrHiwKmXJqW6xncRdRNBh16UYQotKKXezQG9dA7NNnr7gIsg2G3J2ISfn8h_2jZ_6xj9oARc6TmlLqRCMVHpYQqE586YMUXR6UEvS9J6UA0Fxxjb8lsXvuLzLDubMkrOXPFvzw440nOwnubjeN6_bc6qT8z6AuvdmFdQHf1pfTAhJOsNg-SdxssgH-hALevgStAQydLlHFVHXKBh24di_thHm9OwIMUTnvaF-KPyaXBkwS8k0",
"token_type":"bearer",
"expires_in":172799,
"refresh_token":"c9c290dd7ec24example427396686bd8",
"as:client_id":"ByDesignAngularJSShoppingCart",
"userName":"-->r_1001",
"userType":"rep",
"userTypeID":"1",
"displayName":"Exampl Rep Name",
"hasReciprocalID":"False",
"canEnrollAsRep":"True",
"rankTypeID":"10",
".issued":"Fri, 15 Apr 2022 13:37:44 GMT",
".expires":"Sun, 17 Apr 2022 13:37:44 GMT"
}
StatusCode: 200 (Ok) - Customer Authentication
{
"access_token":"LGeuexVB-T0KLrOzY9KzrTk6_bjbURVNxCMHmZO3fzPCwuAR0dEqUoUCeaWcLkUniiJKYeIEZC4GptpmYK1qYIArjC9DCPY4x2LX84-JWbUkfYT7biJyhOest6lM_WjnG9PNFTsr_916tfWgumBsHExampleYb5wJj6odSpGa84FavyvdTv2jrnkWHMi7owJmAs7jgBtsIaMT82RFXvlLPCSg_1EBWqrurXJrbzn1FwOt7NvziM35lnjCE1xyVZHLX6yvRLTR3G6vCOGUBsIXy4r4NJwvNy9WsV88_aa-wstKvbFYGZAoK0arC6uSJNEpgBT-vXeWt4OWzBavmuH4VHOoMQRykaoR4OEy9mtllqOdgmJBzQfnzzHa8MrCBYi2O3wNgC_Q4lp37RjoPiSrXDmlk",
"token_type":"bearer",
"expires_in":172799,
"refresh_token":"667cf03dcaa44Example6537ea3539e",
"as:client_id":"ByDesignAngularJSShoppingCart",
"userName":"-->c_1146820",
"userType":"customer",
"userTypeID":"2",
"displayName":"example customer",
"hasReciprocalID":"False",
"canEnrollAsRep":"True",
"rankTypeID":"",
".issued":"Fri, 15 Apr 2022 14:12:24 GMT",
".expires":"Sun, 17 Apr 2022 14:12:24 GMT"
}
StatusCode: 400 (Bad Request) - Rep or Customer Authentication
{
"error": "invalid_grant",
"error_description": "The user name or password is incorrect."
> }