Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apple ID Token is Faulty (auth code) #63

Open
abegehr opened this issue Nov 16, 2024 · 3 comments
Open

Apple ID Token is Faulty (auth code) #63

abegehr opened this issue Nov 16, 2024 · 3 comments

Comments

@abegehr
Copy link

abegehr commented Nov 16, 2024

The ID token for sign-in-with-apple seems to be a faulty JWT recently.

Checking the code, it the id token is passed as access token and the auth-code is passed as id token: https://github.com/Cap-go/capacitor-social-login/blob/main/ios/Sources/SocialLoginPlugin/AppleProvider.swift#L256 - why is the auth code being assigned to ID token instead of identityToken?

Ref: https://developer.apple.com/documentation/authenticationservices/asauthorizationappleidcredential

@riderx
Copy link
Contributor

riderx commented Nov 17, 2024

The name have been changed to be consistent between all auth systems.
Maybe we can implement an option to keep the original name

@eugenedw
Copy link

eugenedw commented Nov 26, 2024

I ran into this same problem. For now, I'm accessing the accessToken.token to capture the user email address. Thanks to @abegehr for catching that issue - saved me another hour of troubleshooting.

npm install jwt-decode
import { jwtDecode } from 'jwt-decode';
...
if( appleResponse.result != null && appleResponse.result.accessToken ){
   let decoded : any = jwtDecode(appleResponse.result.accessToken.token);
   appleResponse.result.profile.email = decoded['email'];
}

@riderx
Copy link
Contributor

riderx commented Nov 28, 2024

@eugenedw thanks you are a genius ! i added that in swift code ! now you always have the email !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants