Prepare the Bearer Token
Request
Make a request to our firebase endpoint to request for the idToken, which will be used as the bearer token for your GOFA Lesson API requests.
Info Ask GOFA support team for the API key, email account and password to retrieve bearer token to access our GOFA API in our UAT or PRD environment
curl
curl --location 'https://identitytoolkit.googleapis.com/v1/accounts:signInWithPassword?key={API_KEY}' \
--header 'Content-Type: application/json' \
--data-raw '{
"email": "your_email@example.com",
"password": "your_password",
"returnSecureToken": true
}'
javascript
const myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
const raw = JSON.stringify({
email: "your_email@example.com",
password: "your_password",
returnSecureToken: true,
});
const requestOptions = {
method: "POST",
headers: myHeaders,
body: raw,
redirect: "follow",
};
fetch(
"https://identitytoolkit.googleapis.com/v1/accounts:signInWithPassword?key={API_KEY}",
requestOptions,
)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.error(error));
Response:
Now, you can use the idToken for the bearer token.
{
"kind": "identitytoolkit#VerifyPasswordResponse",
"localId": "xNKLVSQ7UdRF2fkCed3iTqu0ML84",
"email": "your_email@example.com",
"displayName": "",
"idToken": "eyJhbGdiOiJSUzI2NiIsImtpZCI6IjAyMTAwNzE2ZmRkOTA0ZTViNGQ0OTExNmZmNWRiZGZjOTg3OTk0MDEiLCJ0eXAiOiJKV1QifQ.eyJhYmMiOnsiY21zIjp7InN0YXR1cyI6ImFjdGl2ZSJ9LCJwbGF5ZXIiOnsic3RhdHVzIjoiYWN0aXZlIn19LCJnb2ZhIjp7ImNtcyI6eyJzdGF0dXMiOiJhY3RpdmUifSwicGxheWVyIjp7InN0YXR1cyI6ImFjdGl2ZSJ9fSwiaGtwZmEiOnsiY21zIjp7InN0YXR1cyI6ImFjdGl2ZSJ9LCJwbGF5ZXIiOnsic3RhdHVzIjoiYWN0aXZlIn19LCJpc3MiOiJodHRwczovL3NlY3VyZXRva2VuLmdvb2dsZS5jb20vZ29mYS1zZGsiLCJhdWQiOiJnb2ZhLXNkayIsImF1dGhfdGltZSI6MTcyNjIwMzQ0Nywid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