Exchange a partner JWT
curl --request POST \
--url https://api.sand.etherfuse.com/auth/token \
--header 'Content-Type: application/json' \
--data '
{
"assertion": "eyJhbGciOiJSUzI1NiIsImtpZCI6Imt...",
"grant_type": "urn:ietf:params:oauth:grant-type:jwt-bearer"
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
assertion: 'eyJhbGciOiJSUzI1NiIsImtpZCI6Imt...',
grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer'
})
};
fetch('https://api.sand.etherfuse.com/auth/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.sand.etherfuse.com/auth/token"
payload = {
"assertion": "eyJhbGciOiJSUzI1NiIsImtpZCI6Imt...",
"grant_type": "urn:ietf:params:oauth:grant-type:jwt-bearer"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"access_token": "<string>",
"expires_in": 3600,
"refresh_token": "<string>",
"token_type": "Bearer",
"scope": "<string>"
}{
"error": "invalid_request",
"error_description": "<string>",
"error_uri": "<string>"
}{
"error": "invalid_request",
"error_description": "<string>",
"error_uri": "<string>"
}{
"error": "invalid_request",
"error_description": "<string>",
"error_uri": "<string>"
}{
"error": "invalid_request",
"error_description": "<string>",
"error_uri": "<string>"
}{
"error": "invalid_request",
"error_description": "<string>",
"error_uri": "<string>"
}Authentication
Exchange a partner JWT
OAuth 2.0 token endpoint (RFC 6749 §3.2). Exchanges a partner-signed JWT for an Etherfuse access token and refresh token, or refreshes an existing session.
Call this from your backend to create a user before a launch, or to get a refresh_token ahead of time so the launch redirect is faster. Your backend signs a JWT with the key behind your registered JWKS and posts it here. To send a user straight into the app in a browser, use POST /auth/launch instead.
Grant types
urn:ietf:params:oauth:grant-type:jwt-bearer(RFC 7523). Put the partner JWT inassertion.refresh_token(RFC 6749 §6). Put an earlierrefresh_tokeninrefresh_token.
The JWT
Sign it with the key behind your registered JWKS. See Sign a user JWT for the details. Claims:
iss: your registered issuer.sub: the person signing in. We strongly recommend a UUID. For an individual customer it’s the same value as their organization’sid, and for a business member it’s theirmemberId. It must be a person, never a business: we reject a business organization id withinvalid_grant, and you can’t reuse asubas a business organization id (POST /organization returns 409). Asubthat isn’t a UUID still signs in, but the Ramp API can’t address it.aud: the token endpoint URL,https://api.etherfuse.com/auth/token(https://api.sand.etherfuse.com/auth/tokenin sandbox).scope: required. Set it to the flow the user may complete. See User Launch Flows. We reject a scope we don’t know withinvalid_scope.jtiornonce: a new value for every token, so we can reject a replay. Send it asjti(the standard JWT ID) ornonce(the standard OIDC claim).exp,iat: required. Keep tokens short-lived.email,name: required. We fill the user’s profile from them.pictureis optional.
This endpoint takes no API key. The signed JWT or refresh token is the credential, so do not send an API key.
POST
/
auth
/
token
Exchange a partner JWT
curl --request POST \
--url https://api.sand.etherfuse.com/auth/token \
--header 'Content-Type: application/json' \
--data '
{
"assertion": "eyJhbGciOiJSUzI1NiIsImtpZCI6Imt...",
"grant_type": "urn:ietf:params:oauth:grant-type:jwt-bearer"
}
'const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
assertion: 'eyJhbGciOiJSUzI1NiIsImtpZCI6Imt...',
grant_type: 'urn:ietf:params:oauth:grant-type:jwt-bearer'
})
};
fetch('https://api.sand.etherfuse.com/auth/token', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.sand.etherfuse.com/auth/token"
payload = {
"assertion": "eyJhbGciOiJSUzI1NiIsImtpZCI6Imt...",
"grant_type": "urn:ietf:params:oauth:grant-type:jwt-bearer"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"access_token": "<string>",
"expires_in": 3600,
"refresh_token": "<string>",
"token_type": "Bearer",
"scope": "<string>"
}{
"error": "invalid_request",
"error_description": "<string>",
"error_uri": "<string>"
}{
"error": "invalid_request",
"error_description": "<string>",
"error_uri": "<string>"
}{
"error": "invalid_request",
"error_description": "<string>",
"error_uri": "<string>"
}{
"error": "invalid_request",
"error_description": "<string>",
"error_uri": "<string>"
}{
"error": "invalid_request",
"error_description": "<string>",
"error_uri": "<string>"
}Body
application/jsonapplication/x-www-form-urlencoded
Response
An access token and a refresh token.