Authentication
The auth
block in ShapeRQ supports three parameters:
Parameter
Required
Description
token
✅
The authentication token used in the request
prefix
❌
A prefix added before the token (e.g., "Bearer"
).
Default: "Bearer"
headerName
❌
The name of the HTTP header to include the token in.
Default: "Authorization"
With all defaults, an authenticated request would look like this:
Authorization: Bearer <token>
Authentication using
createConfig({
Main: {
...
auth: {
token: () => "MainAuthToken",
prefix: "Admin",
headerName: "Authentication"
},
...
},
Secondory: {
...
auth: {
token: () => "MeowMeowMeowMeow",
prefix: "Kitty",
headerName: "Authentication"
},
...
}
});
When using authentication, each key (like "Main"
or "Secondary"
) must match the name used in your requests:
httpGet("Main", "/user");
Last updated