https://kotlinlang.org logo
#ktor
Title
# ktor
f

franek

10/17/2018, 6:37 AM
Hello, I want to integrate google login from android app with Ktor server but I do not know where to start. I find this: https://ktor.io/quickstart/guides/oauth.html but I’m not sure if I need that So my questions: 1. I have clientId also secretId but what is this secretSignKey = hex(“00010”) // @TODO: Remember to change this! Where I can get secretSignKey? 2. With google login SDK I get TOKEN in android app, I need to send this key/token to the server and here I lost 😞 Is there any tutorial how do that? How connect token from google android sdk with oauth on ktor side?
c

cy

10/17/2018, 7:46 AM
1. It's not related to OAuth but to session cookie tracking: in this particulalr example every session is verified using Message Authentication (MAC). See https://ktor.io/servers/features/sessions/transformers.html#SessionTransportTransformerMessageAuthentication // cc @Deactivated User there is a typo: the paragraph starts with wrong class name.
2. we don't have OAuth ktor client example unfortunately. Once you have a token, you need to make login request just like here https://developer.android.com/training/id-auth/authenticate (the last code snippet, except URL: it should be /login ). // cc @Deactivated User perhaps we need to add android ktor cllient login example
f

franek

10/17/2018, 11:08 AM
@cy I read what you send me but I think I do not need that but I could be wrong. Now we use node.js server where is flow (simplified for example): 1. I sign in to google login via android app 2. After success login app retrieve tokenId not TOKEN 3. I send tokenId to our node server like normal post where I only send tokeId is part of login api for me 4. Server retrieve tokenId by me and now server request google api with my tokenId + clientid, secret… for my google profile info. 5. Google api return our server TOKEN and my email… 6. Our server now create me like new user and return me to app token …. So I think I need this: https://developers.google.com/identity/sign-in/android/backend-auth what you think? Problem is Google API Client Library not support Thor. Is there any way how do that?
t

Thomas

07/05/2019, 10:18 PM
@cy is there a sample somewhere for Ktor client OAuth? I'm currently using OkHttp authenticator but need a solution for multiplatform.
219 Views