appwrite icon indicating copy to clipboard operation
appwrite copied to clipboard

Refactor Apple OAuth2 getUserName retrieval logic

Open xuelink opened this issue 1 year ago • 6 comments
trafficstars

What does this PR do?

This PR fixes the bug #7268 Ref to this doc user format

Test Plan

Sign in with Apple to test fetching name or not

Checklist

  • [x] Have you read the Contributing Guidelines on issues?
  • [x] If the PR includes a change to an API's metadata (desc, label, params, etc.), does it also include updated API specs and example docs?

xuelink avatar Feb 16 '24 07:02 xuelink

Even if i try to give scope name, $this->claims returns

Array
(
    [iss] => https://appleid.apple.com
    [aud] => service.com.appwrite.testapp
    [exp] => 1708257457
    [iat] => 1708171057
    [sub] => 000201.4c58eaf074f54eada4d5fe7cf89bf1a7.1559
    [at_hash] => Pe6QnaTkbskuyc2SjzHOLw
    [email] => [email protected]
    [email_verified] => 1
    [is_private_email] => 1
    [auth_time] => 1708171056
    [nonce_supported] => 1
)

However, according to this docs, it should work otherwise it returns empty string as well.

Returning email as a Name paramater of Auth User, completely replaced with returning name with all other OAuth2 services.

Best

xuelink avatar Feb 17 '24 12:02 xuelink

@behics, from what I've read, the name is only provided the first time the user authorizes the OAuth2 app. Every subsequent time, only email is returned. Was your test a fresh authorization or had you authenticated once before?

stnguyen90 avatar Mar 11 '24 12:03 stnguyen90

@behics, from what I've read, the name is only provided the first time the user authorizes the OAuth2 app. Every subsequent time, only email is returned. Was your test a fresh authorization or had you authenticated once before?

@stnguyen90 The test was conducted with a fresh authorization. Every time i deleted user and disconnected auth from apple settings and tried it again

xuelink avatar Mar 13 '24 18:03 xuelink

Is there any update on this? I am doing OAuth using Apple and need name.

raman04-byte avatar Mar 19 '24 09:03 raman04-byte

disconnected auth from apple settings and tried it again

@behics what do you mean by this? Did you disconnect in Appwrite? I was referring to making sure it's the first the the end user authorizes the oauth app.

stnguyen90 avatar Mar 19 '24 14:03 stnguyen90

disconnected auth from apple settings and tried it again

@behics what do you mean by this? Did you disconnect in Appwrite? I was referring to making sure it's the first the the end user authorizes the oauth app.

Yes its the first end user authorizes the oath app.

To test it again, i disconnect user totally between appwrite and "sign-in-with-apple" Before i start to test it,

1- deleted "user which signed in with apple" in appwrite 2- stop user related apple id to "stop using apple ID" 3- try it again from over

Screenshot 2024-03-20 at 3 27 29 AM

xuelink avatar Mar 20 '24 00:03 xuelink

@behics, dang...that is infuriating! I'll try to find some time to test myself as well.

stnguyen90 avatar Mar 20 '24 16:03 stnguyen90

@behics, dang...that is infuriating! I'll try to find some time to test myself as well.

@stnguyen90 unfortunately, apple restrictions make it harder to test it

xuelink avatar Mar 20 '24 22:03 xuelink

Closing PR as this doesn't work.

stnguyen90 avatar Apr 21 '24 16:04 stnguyen90