I am going to use a trained Google Cloud AutoML Vision Model for detecting an object and getting coordinates in React-Native.
I already trained the model but I should use the token for calling the trained model.
I can generate the token by using the gcloud auth application-default print-access-token
But I think the token will expire and users can't call this API.
What is the best solution for this problem?
fetch(
'https://automl.googleapis.com/v1/projects/(projectid)/locations/(locationid)/models/(modelID):predict',
{
method: 'POST',
headers: {
Authorization:
'Bearer (bearer token)',
'Content-Type': 'application/json',
},
contentType: 'application/json',
body: JSON.stringify({
payload: {
image: {
imageBytes: base64Image.base64,
},
},
}),
},
)
This is my code of react-native. Thank you for your answer.