Hi, I am using <https://pub.dev/packages/ory_clien...
# talk-kratos
g
Hi, I am using https://pub.dev/packages/ory_client Dart package to integrate ORY in my Flutter application for social sign-ins like Google, facebook, and Apple logins. currently, I am working on Google Sign-in taking reference from the following link https://www.ory.sh/docs/kratos/social-signin/google What is the flowId mentioned in the Flutter Code example in the given link? From where do we have to get flowId? if we need to call an API to get flowId, what API will give flowId in the case of mobile apps.
g
I am using the api given in the above link and i am getting flow id in return, after this, I hit '*updateRegistrationFlow'* method using the flow id and id_token of google, I am getting response like below, {"id":"someID","oauth2_login_challenge":null,"type":"api","expires_at":"2024-02-21T132343.931974Z","issued_at":"2024-02-21T131343.931974Z","request_url":"https://myurl/self-service/registration/api","ui":{"action":"https://myurl/public/self-service/registration?flow=flowIdFromtheInput","method":"POST","nodes":[{"type":"input","group":"default","attributes":{"name":"csrf_token","type":"hidden","value":"","required":true,"disabled":false,"node_type":"input"},"messages":[],"meta":{}},{"type":"input","group":"oidc","attributes":{"name":"provider","type":"submit","value":"google","disabled":false,"node_type":"input"},"messages":[],"meta":{"label":{"id":7879758,"text":"Continue","type":"info"}}}],"messages":[{"id":4000001,"text":"Social Sign In and OpenID Connect are only supported for flows initiated using the Browser endpoint.","type":"error"}]}} getting some response but I dont know what this line means "*Social Sign In and OpenID Connect are only supported for flows initiated using the Browser endpoint*" . Can some one help me out I want to register my google signin in the ory
e
g
@eager-beach-78267 I am using same api to get the flow id, and here is the API:
final flowIDResponse = await ory?.getFrontendApi().createNativeRegistrationFlow();
flowId = flowIDResponse?.data?.id ?? '';
, and the complete :
Future<void> handleGoogleSignIn(GoogleSignInAccount? value) async {
UpdateRegistrationFlowWithOidcMethod body;
String? idToken;
dio.interceptors.add(NetworkInterceptor(dio,
amplitudeEvent: AmplitudeEvents._socialLoginEvent_));
final api = await OryClient().getFrontendApi();
try {
final flowIDResponse = await ory?.getFrontendApi().createNativeRegistrationFlow();
flowId = flowIDResponse?.data?.id ?? '';
idToken = (await value?.authentication)?.idToken;
if (idToken == null) {
// If we end up here, but there is no ID token, something went wrong
print("No idToken found");
return;
}
} catch (e) {
print(
'Exception when calling FrontendApi->createNativeRegistrationFlow: $e\n');
}
// Create the payload for the updateRegistrationFlow endpoint with the idToken from Google
body = UpdateRegistrationFlowWithOidcMethod(
(b) => b
..idToken = idToken
..method = 'oidc'
..provider = 'google',
);
//Submit the updateRegistrationFlow endpoint with the payload
await ory?.getFrontendApi()?.updateRegistrationFlow(
flow: flowId ?? '',
updateRegistrationFlowBody: UpdateRegistrationFlowBody(
(b) => b..oneOf = OneOf.fromValue1(value: body)),
);
// if(response?.data !=null){
//   print(response?.data?.sessionToken);
// }
}
is this the process to ge the flow id? I am using the same api without optional parameters
e
Is something not working or? Best to post the error. Also try and format with three backticks 3x` to get proper code block formatting.
g
@eager-beach-78267 I already posted the response of updateRegistrationFlow api, here is the API response: {"id":"someID","oauth2_login_challenge":null,"type":"api","expires_at":"2024-02-21T132343.931974Z","issued_at":"2024-02-21T131343.931974Z","request_url":"https://myurl/self-service/registration/api","ui":{"action":"https://myurl/public/self-service/registration?flow=flowIdFromtheInput","method":"POST","nodes":[{"type":"input","group":"default","attributes":{"name":"csrf_token","type":"hidden","value":"","required":true,"disabled":false,"node_type":"input"},"messages":[],"meta":{}},{"type":"input","group":"oidc","attributes":{"name":"provider","type":"submit","value":"google","disabled":false,"node_type":"input"},"messages":[],"meta":{"label":{"id":7879758,"text":"Continue","type":"info"}}}],"messages":[{"id":4000001,"text":"*Social Sign In and OpenID Connect are only supported for flows initiated using the Browser endpoint.*","type":"error"}]}} in the response text attribute defines the error message
e
Sorry, didn't catch that, I'd reach out to one of the ory maintainers then, this behaviour doesn't seem right.
g
@eager-beach-78267 Did you found any reason for the error I am getting