Generating the URL
The base URL is https://bitbadges.io/siwbb/authorize, with parameters appended to it.
For instance:
https://bitbadges.io/siwbb/authorize?client_id=...
This URL structure adheres to the following interface:
Base URL: https://bitbadges.io/siwbb/authorize
Parameters: Custom parameters specific to your implementation.
You can use https://bitbadges.io/auth/linkgen or the code below to generate the URL or click Create SIWBB URL directly from your app in the developer portal (recommended).


Snippets
import { generateBitBadgesAuthUrl, CodeGenQueryParams } from 'bitbadgesjs-sdk';
const popupParams: CodeGenQueryParams {
...
} // See Authentication URL page
const authUrl = generateBitBadgesAuthUrl(popupParams);
export const generateBitBadgesAuthUrl = (params: CodeGenQueryParams) => {
let url = `https://bitbadges.io/siwbb/authorize?`;
for (const [key, value] of Object.entries(params)) {
if (value) {
if (typeof value === 'object') {
const valueString = JSON.stringify(value);
const encodedValue = encodeURIComponent(valueString);
url = url.concat(`${key}=${encodedValue}&`);
} else {
url = url.concat(`${key}=${value}&`);
}
}
}
return url;
};
Last updated