Identity-login not triggered by external providers

I have a very basic identity-login function and I’ve noticed that my external provider logins such as Google do not trigger it.

While using the netlify registered account that will triger the identity-login.

Is this by design, or? Where can I read more about this in the documentation

Have a look here @vorci

Thanks for the response. I’ve read through the documentation there and I can’t say Im still understanding when do certain events trigger things like identity login or identity sign up. Its not very clear.

Hi @vorci,

Yes, it appears as if the function doesn’t trigger when using external OAUTH. The docs that @coelmay linked above do mention that it doesn’t work for signup, but they don’t mention anything for other two events. So, I tested it myself and turns out you’re right. The function doesn’t trigger for external OAUTH provider-based login. While the test does make me believe it’s not possible, I’d also confirm and let you know if that’s the expected behaviour.

With that being said, there’s a workaround for this, if you’re using the Netlify identity Widget, you could do something like how I suggested in the other post (use the login event listener).

2 Likes

Thanks for double checking!
For anyone else reading the workaround you’re mentioning is found on the following page:

Would still be nice to get an official response on this as I can’t be the only one getting some confusion about this.

Hi @vorci,

After checking, I can say this is currently a known issue. So, to trigger a function, you’d have to use a custom function as explained before.

Thanks for the reponse. I have a feeling identity-validate might also not be working at all with both netlify account + external providers.

Is there a bug tracker I could follow to know when this will be fixed?

Hi @vorci,

The validate event like others, does fire on email+password, I got this from the logs:

INFO   {
  rawUrl: 'https://adoring-rosalind-077bfd.netlify.app/.netlify/functions/identity-validate',
  rawQuery: '',
  path: '/.netlify/functions/identity-validate',
  httpMethod: 'POST',
  headers: {
    'accept-encoding': 'gzip',
    'client-ip': '100.64.0.68',
    connection: 'keep-alive',
    'content-length': '347',
    'content-type': 'application/json',
    forwarded: 'for=34.123.113.38;proto=https',
    host: 'adoring-rosalind-077bfd.netlify.app',
    'user-agent': 'Go-http-client/2.0',
    via: 'http/1.1 Netlify[61a0f714-fbfd-4c10-881b-c3bf0edb8497] (Netlify Edge Server)',
    'x-bb-ab': '0.848281',
    'x-bb-client-request-uuid': '01FAZY2H0Q2944SE8N9Y7S07MM',
    'x-bb-ip': '34.123.113.38',
    'x-bb-loop': '1',
    'x-cdn-domain': 'www.bitballoon.com',
    'x-country': 'US',
    'x-datadog-parent-id': '7705675655715539753',
    'x-datadog-sampling-priority': '1',
    'x-datadog-trace-id': '11960724946938632759',
    'x-forwarded-for': '34.123.113.38, 100.64.0.68',
    'x-forwarded-proto': 'https',
    'x-nf-client-connection-ip': '34.123.113.38',
    'x-nf-connection-proto': 'https',
    'x-nf-request-id': '01FAZY2H0Q2944SE8N9Y7S07MM',
    'x-webhook-signature': 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE2MjY3MTY4NDksImlzcyI6ImdvdHJ1ZSIsInN1YiI6IjIyZDY0OWE5LWQ1NTAtNDg5MC1hYTcyLTBhYTU1OTUxNDkxYiIsInNoYTI1NiI6IjIxODhiZDJjNGE1Y2M5N2U5MzQwOTYwMjQ4N2UwYTllOGYyYTg5NTUzMGVkNjhjYmFjNTI3YThlZDU3ZWVlMDQifQ.a7BjRqH_eDxKyU8Bbel4q984if9Xvsr6HG9yEHi8iis'
  },
  multiValueHeaders: {
    'Accept-Encoding': [ 'gzip' ],
    'Client-Ip': [ '100.64.0.68' ],
    Connection: [ 'keep-alive' ],
    'Content-Length': [ '347' ],
    'Content-Type': [ 'application/json' ],
    Forwarded: [ 'for=34.123.113.38;proto=https' ],
    'User-Agent': [ 'Go-http-client/2.0' ],
    Via: [
      'http/1.1 Netlify[61a0f714-fbfd-4c10-881b-c3bf0edb8497] (Netlify Edge Server)'
    ],
    'X-Bb-Ab': [ '0.848281' ],
    'X-Bb-Client-Request-Uuid': [ '01FAZY2H0Q2944SE8N9Y7S07MM' ],
    'X-Bb-Ip': [ '34.123.113.38' ],
    'X-Bb-Loop': [ '1' ],
    'X-Cdn-Domain': [ 'www.bitballoon.com' ],
    'X-Country': [ 'US' ],
    'X-Datadog-Parent-Id': [ '7705675655715539753' ],
    'X-Datadog-Sampling-Priority': [ '1' ],
    'X-Datadog-Trace-Id': [ '11960724946938632759' ],
    'X-Forwarded-For': [ '34.123.113.38, 100.64.0.68' ],
    'X-Forwarded-Proto': [ 'https' ],
    'X-Nf-Client-Connection-Ip': [ '34.123.113.38' ],
    'X-Nf-Connection-Proto': [ 'https' ],
    'X-Nf-Request-Id': [ '01FAZY2H0Q2944SE8N9Y7S07MM' ],
    'X-Webhook-Signature': [
      'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE2MjY3MTY4NDksImlzcyI6ImdvdHJ1ZSIsInN1YiI6IjIyZDY0OWE5LWQ1NTAtNDg5MC1hYTcyLTBhYTU1OTUxNDkxYiIsInNoYTI1NiI6IjIxODhiZDJjNGE1Y2M5N2U5MzQwOTYwMjQ4N2UwYTllOGYyYTg5NTUzMGVkNjhjYmFjNTI3YThlZDU3ZWVlMDQifQ.a7BjRqH_eDxKyU8Bbel4q984if9Xvsr6HG9yEHi8iis'
    ],
    host: [ 'adoring-rosalind-077bfd.netlify.app' ]
  },
  queryStringParameters: {},
  multiValueQueryStringParameters: {},
  body: '{"event":"validate","instance_id":"22d649a9-d550-4890-aa72-0aa55951491b","user":{"id":"9dbc7444-8514-438f-bc83-3233cd2b2edc","aud":"","role":"","email":"foo@bar.com","app_metadata":{"provider":"email"},"user_metadata":{"full_name":"Hrishikesh Test"},"created_at":"2021-07-19T17:47:29.016937Z","updated_at":"2021-07-19T17:47:29.019389Z"}}',
  isBase64Encoded: false
}

I logged event in console. As you can see, the user is in event.body.user and event.body.event says validate.

The issue about OAuth providers not working is being tracked internally only at the moment.

1 Like

I’d like to re-add that I am still getting user object inside body in all 3 events. Could you share your code in which this doesn’t happen? I’m really curious to test this and if it’s true, I think it is unexpected behaviour and we’d have to add it to the list of things to fix.

I’ve checked and you’re correct. I don’t know what I was looking at day before yesterday but it looks fine now. I’ve deleting my comment as it’s incorrect

1 Like