> For the complete documentation index, see [llms.txt](https://docs.tebex.io/developers/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tebex.io/developers/headless-api/guides/baskets/authorize-a-basket.md).

# Authorize a Basket

Depending on the type of Tebex store you are integrating, authorization may be required at checkout.

For most stores, the user must authorize their account before checkout is completed.&#x20;

This is done via the **/auth** endpoint where we will return the authentication options available for your store type.

Provide a `returnUrl` , and after successful authentication the user will be directed back to your site.

## Get auth links for basket

> Fetches a basket's auth URL. The player should be directed here in order for them to authorize their account.\
> When complete, they will be returned to the provided \`returnUrl\` and the basket will be authorized from that moment onwards.

```json
{"openapi":"3.1.0","info":{"title":"Tebex Headless API","version":"2.1.0"},"tags":[{"description":"Main API scoped to public token","name":"Headless"}],"servers":[{"description":"Main API scoped to public token","url":"https://headless.tebex.io/api/accounts/{token}","variables":{"token":{"default":"YOUR_PUBLIC_TOKEN","description":"The store's public token"}}}],"paths":{"/baskets/{basketIdent}/auth?returnUrl={returnUrl}":{"get":{"description":"Fetches a basket's auth URL. The player should be directed here in order for them to authorize their account.\nWhen complete, they will be returned to the provided `returnUrl` and the basket will be authorized from that moment onwards.","operationId":"getBasketAuthUrl","parameters":[{"$ref":"#/components/parameters/basketIdent"},{"description":"The URL you would like to redirect the user to after successful basket authentication.","explode":false,"in":"path","name":"returnUrl","required":true,"schema":{"type":"string"},"style":"simple"}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BasketAuthResponse"}}},"description":"Successful response returns the auth provider options and URLs of the sign-in link."},"422":{"description":"The provided webstore ID or basket ID is invalid."}},"summary":"Get auth links for basket","tags":["Headless"]}}},"components":{"parameters":{"basketIdent":{"description":"The basket identifier.","explode":false,"in":"path","name":"basketIdent","required":true,"schema":{"type":"string"},"style":"simple"}},"schemas":{"BasketAuthResponse":{"items":{"$ref":"#/components/schemas/BasketAuthResponse_inner"},"type":"array"},"BasketAuthResponse_inner":{"properties":{"name":{"type":"string"},"url":{"type":"string"}}}}}}
```

\#
