google-app-engine


Go GAE Using LoginURLFederated function returns API error 2 (user: NOT_ALLOWED)


I am trying to use LoginURLFederated for logging users in. My code is as follows:-
c := appengine.NewContext(r)
u, _ := user.CurrentOAuth(c, "")
if u == nil {
if loginUrl, err := user.LoginURLFederated(c, "/webservice/uid-test", "gmail.com"); err != nil {
http.Error(w, "here1"+err.Error(), http.StatusInternalServerError)
return
} else {
http.Redirect(w, r, loginUrl, http.StatusFound)
return
}
}
I got this error
here1API error 2 (user: NOT_ALLOWED)
When I change from LoginURLFederated to LoginURL function, it worked fine. What did I miss? I tried to use user.Current(c) as well, however, I didn't work either.
The reason I am doing this is because I am trying to verify the idToken that is being sent from an android app that uses google sign-in api for signing in. Google sign in api implements oauth2 standard and generate idToken for other app: in this case, my web app written in Go running on GAE, to use the idToken to verify the signed in user. More information about android google sign in is here https://developers.google.com/identity/sign-in/android/backend-auth#send-the-id-token-to-your-server
However, I didn't realize that Google ID that I received from calling user.LoginURL(c) in Go web app on GAE was different from the sub value (ID) received from calling Google idToken endpoint here
https://www.googleapis.com/oauth2/v3/tokeninfo?id_token=value
Then I realized that the IDs were generated by two different Google endpoints. I decided to use Google federated login function on the web app side to match the ID received from
https://www.googleapis.com/oauth2/v3/tokeninfo?id_token=value
since federated login implements openid (oauth) but I am receiving an unknown error API error 2 (user: NOT_ALLOWED)
Am I doing things right? Can federated login generate the identical id with the sub value (id) sent from google idToken endpoint?

Related Links

Google App Engine Go memory management
How to build Many-to-Many relations in Google App-engine using JPA
Currently experiencing frequent DeadlineExceededExceptions when it was fine a few hours ago
How to get related to db.Model entity from datastore - what API allows it?
GAE-Python: Can Appstats record RPC made in background thread?
Blank Page after granting OAuth2 permission in BigQuery GAE Sample
GAE get Data using JDO with key
Setup GAE project with Resteasy using Maven in Eclipse
Working Maven3 configuration for AppEngine + DataNucleus + JPA 2
Spring Security ACL on App Engine Datastore
JDO 1:N issue (retriving data)
Endpoints Bad Api Configuration
Resolving an invalid memory address or nil pointer dereference
Design suggestion for an app which will wake up periodically and execute some long running tasks
Properly using map[string]interface{}?
Multiple calls to put() method when updating ndb on google app engine

Categories

HOME
uml
algorithm
cygwin
gridview
string
flex
static
socket.io
access
little-proxy
openstreetmap
filechannel
comsol
flash-player
http-post
job-scheduling
easyphp
smartclient
swagger-2.0
boost-icl
simpleitk
asciidoctor-pdf
breadth-first-search
react-toolbox
hta
gmock
strongname
xcode-ui-testing
bulletphysics
corpus
mat
outliers
tpm
iis-express
uitapgesturerecognizer
aws-codecommit
kudu
utorrent
database-comparison
memory-address
android-maps-extensions
dynamic-jasper
nested-lists
html-encode
jwplayer6
swagger-php
watchman
google-earth-engine
timing
projects-and-solutions
sim-card
apns-php
skylink
mesosphere
sonarlint-eclipse
datamaps
zenhub
magic-draw
tinkerpop
payload
lsyncd
trigger.io
cd-burning
swingworker
filenet
avspeechsynthesizer
refinerycms
cortex-m
fuzzywuzzy
jaunt-api
iokit
forwarding
opserver
coda
sony-lifelog-api
haskell-warp
snoop
exceldatareader
ghcjs
webfinger
raygun
twitter-bootstrap-rails
openargs
printdialog
rolify
asdf
dopostback
paginator
convention
role
promotion-code
winmain
uideviceorientation
mathematical-notation
firefox-3

Resources

Encrypt Message