OAuth2 Redirect URL Question
Posted: Thu Oct 26, 2023 2:26 pm
Hi All
Read the notes on oauth2 in 10.0 DP6 and I could prepare the following button script for Google authentication using OAuth2.
In the "Client ID for Web application" page over at Google API portal, I've kept the Auth. Redirect URL empty.
My Button Script:
[indent]on mouseup
constant kAuthURL = "https://accounts.google.com/o/oauth2/auth"
constant kTokenURL = "https://oauth2.googleapis.com/token"
constant kClientID = "274593072165-oiud666u9j7vbquu.apps.googleusercontent.com"
constant kClientSecret = "com.googleusercontent.apps.2745662165-8t8266kig5qjbacj4"
constant kScopes = "https://www.googleapis.com/auth/userinfo.email"
if the environment is "mobile" then
OAuth2 \
kAuthURL, \
kTokenURL, \
kClientID, \
kClientSecret, \
kScopes, \
"in.tal3ic.tal3ic://tal3ic"
//assume tal3ic.in is my website, and I have also added tap3ic in the CustomURL field in Standalone Settings for iOS
end if
put the result into tres
answer tres
if tres is not empty then
answer error "Not authorized!"
else
//<retrieve email id via JSON from API endpoint>
end if
end mouseup[/indent]
Is this a proper approach for iOS? Especially the Authorized Redirect URL.
Many thanks in advance.
Vikram
Read the notes on oauth2 in 10.0 DP6 and I could prepare the following button script for Google authentication using OAuth2.
In the "Client ID for Web application" page over at Google API portal, I've kept the Auth. Redirect URL empty.
My Button Script:
[indent]on mouseup
constant kAuthURL = "https://accounts.google.com/o/oauth2/auth"
constant kTokenURL = "https://oauth2.googleapis.com/token"
constant kClientID = "274593072165-oiud666u9j7vbquu.apps.googleusercontent.com"
constant kClientSecret = "com.googleusercontent.apps.2745662165-8t8266kig5qjbacj4"
constant kScopes = "https://www.googleapis.com/auth/userinfo.email"
if the environment is "mobile" then
OAuth2 \
kAuthURL, \
kTokenURL, \
kClientID, \
kClientSecret, \
kScopes, \
"in.tal3ic.tal3ic://tal3ic"
//assume tal3ic.in is my website, and I have also added tap3ic in the CustomURL field in Standalone Settings for iOS
end if
put the result into tres
answer tres
if tres is not empty then
answer error "Not authorized!"
else
//<retrieve email id via JSON from API endpoint>
end if
end mouseup[/indent]
Is this a proper approach for iOS? Especially the Authorized Redirect URL.
Many thanks in advance.
Vikram