> 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

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.0.0"},"tags":[{"name":"Headless","description":"Main API scoped to public token"}],"servers":[{"url":"https://headless.tebex.io/api/accounts/{token}","description":"Main API scoped to public token","variables":{"token":{"default":"","description":"The store's public token"}}}],"paths":{"/baskets/{basketIdent}/auth?returnUrl={returnUrl}":{"get":{"tags":["Headless"],"operationId":"getBasketAuthUrl","summary":"Get auth links for basket","parameters":[{"$ref":"#/components/parameters/basketIdent"},{"in":"path","name":"returnUrl","description":"The URL you would like to redirect the user to after successful basket authentication.","schema":{"type":"string"},"required":true}],"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.","responses":{"200":{"description":"Successful response returns the auth provider options and URLs of the sign-in link.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BasketAuthResponse"}}}},"422":{"description":"The provided webstore ID or basket ID is invalid."}}}}},"components":{"parameters":{"basketIdent":{"name":"basketIdent","in":"path","required":true,"schema":{"type":"string"},"description":"The basket identifier."}},"schemas":{"BasketAuthResponse":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string"},"url":{"type":"string"}}}}}}}
```

\#
