Authorize an Instacart user for account linking
POST /v2/fulfillment_sandbox/instacart_users/{user_id}/authorize
Authorizes an Instacart user for account linking.
Security
Name | In | Description |
---|---|---|
Authorization | header | The Authorization header with the bearer token acquired during authentication. |
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
user_id | path | integer | The ID of the Instacart user created through FulfillmentSandbox.CreateInstacartUser endpoint. |
Request
Field | Type | Required | Description |
---|---|---|---|
redirect_uri | string | The redirect URI when the authorization code was generated. | |
scope | string | The OAuth2 scopes needed for authoriation. | |
code_challenge_method | string | The code challenge method. | |
code_challenge | string | The code challenge. |
Request examples
- cURL
- Java
- Python
- Go
curl --request POST \
--url 'https://connect.instacart.com/v2/fulfillment_sandbox/instacart_users/{user_id}/authorize' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"redirect_uri": "string",
"scope": "string",
"code_challenge_method": "string",
"code_challenge": "string"
}'
HttpResponse<String> response = Unirest.post("https://connect.instacart.com/v2/fulfillment_sandbox/instacart_users/{user_id}/authorize")
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.header("Authorization", "Bearer <token>")
.body("{\n \"redirect_uri\": \"string\",\n \"scope\": \"string\",\n \"code_challenge_method\": \"string\",\n \"code_challenge\": \"string\"\n}")
.asString();
import http.client
conn = http.client.HTTPSConnection("connect.instacart.com")
payload = "{\n \"redirect_uri\": \"string\",\n \"scope\": \"string\",\n \"code_challenge_method\": \"string\",\n \"code_challenge\": \"string\"\n}"
headers = {
'Accept': "application/json",
'Content-Type': "application/json",
'Authorization': "Bearer <token>"
}
conn.request("POST", "/v2/fulfillment_sandbox/instacart_users/{user_id}/authorize", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://connect.instacart.com/v2/fulfillment_sandbox/instacart_users/{user_id}/authorize"
payload := strings.NewReader("{\n \"redirect_uri\": \"string\",\n \"scope\": \"string\",\n \"code_challenge_method\": \"string\",\n \"code_challenge\": \"string\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Accept", "application/json")
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response
Field | Type | Required | Description |
---|---|---|---|
code | string | The authorization code that can be exchanged for access token. |
Response examples
200 Success
200
Authorization code created
{
"code": "zth2LONsv7xVq76ocOcS9ZYwc_eZLdDNX74Z9gSgilk"
}
4XX Errors
Error responses return either a single error or multiple errors.
HTTP Code | Cause | Error Message | Error Code | Error Meta |
---|---|---|---|---|
400 | Invalid user_id | "Invalid user_id" | 1001 | {"key":"user_id"} |