Each time we send a request for classification through api it asks for authentication and we want it to authorize all requests automatically.
We tried OAuth2 but it did not generate a key. Please suggest a valid solution. The model is deployed on vertex ai, it's not custom. After going through the above mentions we decided to access the vertex AI API by service account but still it shows error
raise exceptions.from_grpc_error(exc) from exc google.api_core.exceptions.Unknown: None Stream removed
Provided we have successfully mentioned the API endpoint as
model_name = f'projects/{PROJECT_ID}/locations/{LOCATION}/models/{MODEL_ID}:predict'
and we have also provided the role of Vertex AI Administrator in IAM roles to that specific service account.
you could use :
API Key Authentication:
Implement API key authentication, where each user or application is issued a unique API key. Users include this key in their requests, and your API server validates the key to authorize access. This method is simple and doesn't require users to perform OAuth2-style authentication.
OR
Token-Based Authentication:
Instead of OAuth2, consider implementing a custom token-based authentication system. Users authenticate once, typically by providing their username and password, and receive a token in return. This token is then included in subsequent requests to prove their identity.