-
Notifications
You must be signed in to change notification settings - Fork 441
Open
Description
When using Supabase Auth, the standard supabase endpoint to rotate tokens only accepts 'Content-Type': 'application/json'. Requests with content type ´application/x-www-form-urlencoded` fail with the following response:
{status: 400, response: null, error: '{"code":400,"error_code":"bad_json","msg":"Could not parse request body as JSON: unexpected end of JSON input"}', success: false}
The current docs only show POST requests with Form content type.
Would it be possible to add an option to send the refresh token request using application/json, and using an object in the payload instead of form data?
Sample Config
authorization: {
accessToken: session.access_token,
strategy: BackgroundGeolocation.AuthorizationStrategy.Jwt,
expires: session.expires_in,
refreshToken: session.refresh_token,
refreshUrl: supabaseUrl + '/auth/v1/token?grant_type=refresh_token', // <--- default supabase endpoint to refresh tokens
refreshHeaders: {
apikey: supabaseKey,
'Content-Type': 'application/json',
},
refreshPayload: {
refresh_token: '{refreshToken}',
},
refreshEncoding: BackgroundGeolocation.Encoding.JSON, // <--- sommething like this
}
Metadata
Metadata
Assignees
Labels
No labels