refreshPayload property
Refresh payload will be encoded into the FORM POST to the refreshUrl when requesting a new accessToken after expiration.
You must provide one field-template which will represent your "refresh token" using the value: {refreshToken}
. The SDK will
automatically replace this simple template with the configured refreshToken.
Example
BackgroundGeolocation.ready(Config(
authorization: Authorization(
strategy: "JWT",
accessToken: "XXX.YYY.ZZZ",
refreshUrl: "https://auth.domain.com/tokens",
refreshToken: "smTsfaspfgaadsfgqZerUt0wueflasdfkaxjdfeKIacb",
refreshPayload: {
"my_refresh_token": "{refreshToken}", // <-- replaced with configured refreshToken above.
"grant_type": "refresh_token", // <-- arbitrary fields required by your auth server
"foo": "another arbitrary field"
}
)
));
With the configuration above, a curl
representation of the SDK's FORM POST, might look like this:
$ curl -X POST \
-F 'my_refresh_token=smTsfaspfgaadsfgqZerUt0wueflasdfkaxjdfeKIacb' \
-F 'grant_type=refresh_token' \
-F 'foo=another arbitrary field' \
https://auth.your.server.com/tokens
Implementation
Map? refreshPayload;