Hello, we're wondering if there is there a way to ...
# talk-kratos
i
Hello, we're wondering if there is there a way to get the identity credentials for a user (logged in) when initialising the self service flows in our frontend app? When the user navigates to the account settings page we would like to check the credentials to view what login methods have been enabled (password and/or social sign in). Or is this only available through the
adminGetIdentity
call and passing in the
id
? We call
initializeSelfServiceSettingsFlowForBrowsers
(or
getSelfServiceSettingsFlow
if we have the flowId) but we can't see the credentials as part of the response.
c
you need the session cookie or token to get the identity details
i
Thanks! Do you mean we need to pass in the session cookie or token to the
initializeSelfServiceSettingsFlowForBrowsers
or
getSelfServiceSettingsFlow
call? We get the identity back from the calls but it doesn't include the
credentials
of that identity. The user is logged in so the session cookie is already set.
c
but
credentials
are what you are passing in to get the identity right?
i
We're not passing in anything when calling
kratos.initializeSelfServiceSettingsFlowForBrowsers
. But we have set
withCredentials
in the below configuration.
Copy code
export const kratos = new V0alpha2Api(
  new Configuration({
    basePath: process.env.VUE_APP_ORY_KRATOS_URL || '<http://127.0.0.1:4433/>',
    baseOptions: {
      withCredentials: true,
    },
  }),
);
c
thats initializing the flow, which doesn't depend on passing the session cookie
initializing a flow is a stateless call
the session cookie authenticates a user
i
Right ok. So is it when we call
toSession
(to see if the user is logged in) we should pass in the session cookie to be able to get the
identity
with the
credentials
included back?
c
yes
you'll get the
identity
details for the user. What credentials are you referring about?
i
I'm talking about the credentials listing what sign in methods the user has enabled.
oidc
or
password
for example.
We do get the identity back but it doesn't include that list
c
can you post your
identity
object?
the methods are enabled in the config. why do you expect them to be part of the identity?
i
because the
credentials
are part of the
Identity
interface, although optional. We wanted to check them in our frontend app to see what login methods have been enabled for that user (password and/or social sign in) 🙂 but seems like it might not be possible.
c
I dob't think its possible to configure the methods per user. It's global config
d
I think it’s more that the user chooses whether to log in with github or google or email (or all) and it would be good to see which one(s) they have chosen to use.