Reputation: 21
I am a novice developer who wants to learn how to use artificial intelligence. So I created model and it responds correctly according to the inputs. So I want to test using postman a call to the API to verify that everything works and I have an error in my call: "message": "Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.", "status": "UNAUTHENTICATED" I don't know how to authenticate myself to retrieve the access token. Could you help me find a solution please?
Upvotes: 2
Views: 2265
Reputation: 507
I've encountered a similar error with Google calendar in SwiftUI. I fixed it by specifying the authorizer
info from the signed-in user
let service = GTLRCalendarService()
service.authorizer = user.fetcherAuthorizer
service.executeQuery(insertQuery) { (ticket, object, error) ... }
A full sample app is available in github.
Upvotes: 0
Reputation: 75910
You have 2 solutions:
gcloud auth login
or gcloud init
(proposed at the end of the installation)gcloud auth print-access-token
and copy it
gcloud ai-platform models add-iam-policy-binding --member="allUsers" \
--role="roles/ml.modelOwner" <Model Name>
replace Model Name by your deployed model. However, it's only for test purpose. You have any filter and anyone can use it and you will pay for the processing incurs.
Upvotes: 2