Open TheNemus opened 2 years ago
having the same issue: did you find any workaround?
having the same issue. Anyone solved this issue?
It actually works on real devices. I've made it working
Il Mer 20 Ott 2021, 19:59 devmanagalaxy @.***> ha scritto:
having the same issue. Anyone solved this issue?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/capacitor-community/apple-sign-in/issues/60#issuecomment-947906575, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKFB5GW4BDH3HUA7UQNMFNTUH37QLANCNFSM5FYLGNFQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
wow, that's great, @ciccilleju thanks for your reply. so did you use v1.0.1?
Yes exactly, I have installed the library with npm, imported it in the typescript file, and then ran the authorize function. I got the response back with all my data(token, email, name, surname). Beware that you will get those info only at the first login attempt, all the other times you will get "null" for those fields but idToken. For getting them back you need to remove the authorization from your device from options->apple id-> your app
Il Mer 20 Ott 2021, 20:03 devmanagalaxy @.***> ha scritto:
wow, that's great, @ciccilleju https://github.com/ciccilleju thanks for your reply. so did you use v1.0.1?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/capacitor-community/apple-sign-in/issues/60#issuecomment-947909820, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKFB5GSWF4YAYCRYNAK3MJDUH3773ANCNFSM5FYLGNFQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
let options: SignInWithAppleOptions = {
clientId: 'jeffrey.app',
redirectURI: 'https://www.yourfrontend.com/login',
scopes: 'email',
state: '12345',
nonce: 'nonce',
};
SignInWithApple.authorize(options).then((result: SignInWithAppleResponse) => {
console.log("Debug apple login:", JSON.stringify(result.response));
});
I am trying to apple login with v1.0.1. but I failed. I don't know clientId, redirectURI well. Do you know that well?
What does the error say? Are you trying on areal device?
Il Mer 20 Ott 2021, 20:15 devmanagalaxy @.***> ha scritto:
let options: SignInWithAppleOptions = { clientId: 'jeffrey.app', redirectURI: 'https://www.yourfrontend.com/login', scopes: 'email', state: '12345', nonce: 'nonce', }; SignInWithApple.authorize(options).then((result: SignInWithAppleResponse) => { console.log("Debug apple login:", JSON.stringify(result.response)); });
I am trying to apple login with v1.0.1. but I failed.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/capacitor-community/apple-sign-in/issues/60#issuecomment-947918984, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKFB5GV4CNU276LHZPZRXWLUH4BNRANCNFSM5FYLGNFQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
here a sample of my code:
the ts file:
import { SignInWithApple, SignInWithAppleOptions, SignInWithAppleResponse } from '@capacitor-community/apple-sign-in';
@Injectable({ providedIn: 'root' })
export class AppleSigninService { userData: any; token: any; serviziRest: any = serviziRest;
constructor( ) {
}
openAppleSignIn() {
let options: SignInWithAppleOptions = {
clientId: 'myapp.mybundle.com',
redirectURI: '',
scopes: 'email, name',
state: '12345',
nonce: 'nonce'
};
SignInWithApple.authorize(options)
.then(async (res: SignInWithAppleResponse) => {
console.log(res);
if (res.response && res.response.identityToken) {
alert(JSON.stringify(res));
} else {
this.alertService.alertError('Error Apple Signin');
}
})
.catch((error) => {
console.error(error);
this.alertService.alertError(error);
});
}
}
the html file has just the function call to openAppleSignIn()
did you add the sign in capability in your xcode? you need to enable it from your developer account and then add to xcode from here:
yeah, of course, I added the capability in Xcode.
ERROR {"code":"auth/missing-or-invalid-nonce","message":"Nonce is missing in the request."}
this is the error message when apple logged in
in SignIn Options, clientId is same as app bundle Id?
Yes exactly, I have installed the library with npm, imported it in the typescript file, and then ran the authorize function. I got the response back with all my data(token, email, name, surname). Beware that you will get those info only at the first login attempt, all the other times you will get "null" for those fields but idToken. For getting them back you need to remove the authorization from your device from options->apple id-> your app Il Mer 20 Ott 2021, 20:03 devmanagalaxy @.***> ha scritto: … wow, that's great, @ciccilleju https://github.com/ciccilleju thanks for your reply. so did you use v1.0.1? — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#60 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKFB5GSWF4YAYCRYNAK3MJDUH3773ANCNFSM5FYLGNFQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
For getting them back you need to remove the authorization from your device from options->apple id-> your app
I didn't find the path. can you share that as screenshot how I can remove the authorization from my iphone?
{"authorizationCode":"cb5b9e6f054484070bbae53d461aa8d3b.0.sxzs.OJCuk02wLs7BKvJiHz-c5Q","identityToken":"eyJraWQiOiI4NkQ4OEtmIiwiYWxnIjoiUlMyNTYifQ.eyJpc3MiOiJodHRwczovL2FwcGxlaWQuYXBwbGUuY29tIiwiYXVkIjoiamVmZnJleS5hcHAiLCJleHAiOjE2MzQ4NDE0MTMsImlhdCI6MTYzNDc1NTAxMywic3ViIjoiMDAwNzkyLjQyNDI0NTAwYTIyMzRkNTBhNDg5ZWQwOTA0NzM5MDEyLjAyMjIiLCJub25jZSI6Im5vbmNlIiwiY19oYXNoIjoib1JSZlhTaXJHS2N6SmczV0FhcXhOQSIsImF1dGhfdGltZSI6MTYzNDc1NTAxMywibm9uY2Vfc3VwcG9ydGVkIjp0cnVlfQ.PBdIn45BMyx9PGjJm5VTpg9YGWvJ9WkcOpG-dGHF40z1j8NsRCj_3S_mCJsju8ak5rGqR5RZV-gHhm6NJT6xP1hvAOPG9eanNr9aH0H5XY4rZfZKGs67jQ-JllWMloPSda4Yu-6FjPuCdFSJa1w1YQdUGDO-x2h3yC1lkA6COGymYDPMZIdU4Qjq0c6wrAu4o2lFE8fqUk88apZlQVqPhLZLh549g_6wxweuTunBF0OsK7acreOQkwBIPyGrrDOmq96fVv8b0kDwcdOY4A_y6apEqcC1p0j2TL2aXqrHW8LVV97ZvN3JTe_q6wYqf2Ka44C5yhLO0PYIqEDdII6oMQ","givenName":null,"familyName":null,"user":"000792.42424500a2234d50a489ed0904739012.0222","email":null}
you are right, I am getting null of email, familyName and givenName. plz help me.
It's OK getting null! It's working :) you get those fields only the first time you sign in, after that you need to remove the authorization from options-> apple id
Il Mer 20 Ott 2021, 20:50 devmanagalaxy @.***> ha scritto:
{"authorizationCode":"cb5b9e6f054484070bbae53d461aa8d3b.0.sxzs.OJCuk02wLs7BKvJiHz-c5Q","identityToken":"eyJraWQiOiI4NkQ4OEtmIiwiYWxnIjoiUlMyNTYifQ.eyJpc3MiOiJodHRwczovL2FwcGxlaWQuYXBwbGUuY29tIiwiYXVkIjoiamVmZnJleS5hcHAiLCJleHAiOjE2MzQ4NDE0MTMsImlhdCI6MTYzNDc1NTAxMywic3ViIjoiMDAwNzkyLjQyNDI0NTAwYTIyMzRkNTBhNDg5ZWQwOTA0NzM5MDEyLjAyMjIiLCJub25jZSI6Im5vbmNlIiwiY19oYXNoIjoib1JSZlhTaXJHS2N6SmczV0FhcXhOQSIsImF1dGhfdGltZSI6MTYzNDc1NTAxMywibm9uY2Vfc3VwcG9ydGVkIjp0cnVlfQ.PBdIn45BMyx9PGjJm5VTpg9YGWvJ9WkcOpG-dGHF40z1j8NsRCj_3S_mCJsju8ak5rGqR5RZV-gHhm6NJT6xP1hvAOPG9eanNr9aH0H5XY4rZfZKGs67jQ-JllWMloPSda4Yu-6FjPuCdFSJa1w1YQdUGDO-x2h3yC1lkA6COGymYDPMZIdU4Qjq0c6wrAu4o2lFE8fqUk88apZlQVqPhLZLh549g_6wxweuTunBF0OsK7acreOQkwBIPyGrrDOmq96fVv8b0kDwcdOY4A_y6apEqcC1p0j2TL2aXqrHW8LVV97ZvN3JTe_q6wYqf2Ka44C5yhLO0PYIqEDdII6oMQ","givenName":null,"familyName":null,"user":"000792.42424500a2234d50a489ed0904739012.0222","email":null}
you are right, I am getting null of email, familyName and givenName. plz help me.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/capacitor-community/apple-sign-in/issues/60#issuecomment-947944251, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKFB5GV67QMF723KDPJTAADUH4FPXANCNFSM5FYLGNFQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
Inside your iOS device, open the settings app and navigate to Apple ID -> Password & Security -> Apple ID logins. In this screen, you can see all the apps where you used Apple Sign In, and you can simply delete the entry for your own app.
Now you can test the process again inside your app, and the initial dialog to sign in will show up again like in the image you see below.
Thanks, I can get the correct email, givenName after removing my app from apple id logins.
last question, should I remove my app from apple id logins whenever apple login?
No, it's unnecessary. Don't hesitate to ask if you need any further information
Francesco
Il Mer 20 Ott 2021, 21:06 devmanagalaxy @.***> ha scritto:
Thanks, I can get the correct email, givenName after removing my app from apple id logins.
last question, should I remove my app from apple id logins whenever apple login?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/capacitor-community/apple-sign-in/issues/60#issuecomment-947956149, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKFB5GV22BBVUA7WKJEEUEDUH4HMNANCNFSM5FYLGNFQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
Thanks, There is any method to unauthorize apple(mean logout)? or is this a stupid question?
I usually use a backend for authentication, if the idToken is correct, the backend gives me.back a token that i store in my local storage and then, every time I open the app I check if it's present. On logout I simply remove the token and uom the next apple sign I'm a store a new token
Il Mer 20 Ott 2021, 21:18 devmanagalaxy @.***> ha scritto:
Thanks, There is any method to unauthorize apple(mean logout)? or is this a stupid question?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/capacitor-community/apple-sign-in/issues/60#issuecomment-947963985, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKFB5GQ7KRUMD6V5SV5INS3UH4IWXANCNFSM5FYLGNFQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
I'm in the same point.
When I set the password, I don't have any alert or console log to see the response
Using Vue (not typescript)
async loginApple() {
const options = {
clientId: 'es.yakk',
redirectURI: '',
scopes: 'email, name',
state: '12345',
nonce: 'nonce',
};
SignInWithApple.authorize(options)
.then((res) => {
alert(JSON.stringify(res));
if (res.response && res.response.identityToken) {
alert(JSON.stringify(res));
} else {
this.alertService.alertError('Error Apple Signin');
alert('ERROR');
}
})
.catch((error) => {
console.error(error);
this.alertService.alertError(error);
alert('ERROR FINAL');
});
},
If I set an incorrect password, it fails.
If I set the correct password, it don't show anything
If I cancel, I got the debug message
2021-10-22 14:31:06.314334+0200 App[69005:2760796] [core] Authorization failed: Error Domain=AKAuthenticationError Code=-7003 "(null)" UserInfo={AKClientBundleID=es.yakk}
ERROR MESSAGE: {"errorMessage":"The operation couldn’t be completed. (com.apple.AuthenticationServices.AuthorizationError error 1001.)","message":"The operation couldn’t be completed. (com.apple.AuthenticationServices.AuthorizationError error 1001.)"}
⚡️ [error] - {"errorMessage":"The operation couldn’t be completed.
It actually works on real devices. I've made it working Il Mer 20 Ott 2021, 19:59 devmanagalaxy @.***> ha scritto: …
Then, only works on real device???
It actually works on real devices. I've made it working Il Mer 20 Ott 2021, 19:59 devmanagalaxy @.***> ha scritto: …
Then, only works on real device???
yeah, that only worked on real devices.
here a sample of my code:
the ts file:
import { SignInWithApple, SignInWithAppleOptions, SignInWithAppleResponse } from '@capacitor-community/apple-sign-in';
@Injectable({ providedIn: 'root' })
export class AppleSigninService { userData: any; token: any; serviziRest: any = serviziRest;
constructor( ) {
}
openAppleSignIn() {
let options: SignInWithAppleOptions = { clientId: 'myapp.mybundle.com', redirectURI: '', scopes: 'email, name', state: '12345', nonce: 'nonce' }; SignInWithApple.authorize(options) .then(async (res: SignInWithAppleResponse) => { console.log(res); if (res.response && res.response.identityToken) { alert(JSON.stringify(res)); } else { this.alertService.alertError('Error Apple Signin'); } }) .catch((error) => { console.error(error); this.alertService.alertError(error); });
}
}
the html file has just the function call to openAppleSignIn()
i tried your code on real device and ist not working. It's logging: [error] - {"code":"UNIMPLEMENTED"}
Any suggestions?
Here is my code, it's vue:
import { SignInWithApple } from '@capacitor-community/apple-sign-in';
async loginApple() {
const options = {
clientId: 'my.bundle.app',
redirectURI: '',
scopes: 'email, name',
state: '12345',
nonce: 'nonce',
};
await SignInWithApple.authorize(options)
.then(async (res) => {
if (res.response && res.response.identityToken) {
this.$api.post('apple_login', res.response).then(({ data }) => {
this.$apidefaults.headers = { common: { Authorization: `Bearer ${data.token}` } };
this.$q.localStorage.set('token', data.token);
this.$q.localStorage.set('user', data.user);
this.$store.commit('user', data.user);
this.$router.push({ name: 'home' });
}).catch((error) => {
this.$router.push({ name: 'signup', params: res.response });
console.log(error);
});
} else {
this.alertService.alertError('Error Apple Signin');
}
})
.catch((error) => {
console.error(error);
alert('Cancelado por el usuario');
});
},
Only works on real device, in emulator I can see anything
@sbellver
not working for me on real device.
`
async loginApple() {
const options = {
clientId: 'my.bundle.app',
redirectURI: '',
scopes: 'email, name',
state: '12345',
nonce: 'nonce',
};
await SignInWithApple.authorize(options)
.then(async (res) => {
console.log('SignInWithApple', res);
})
.catch((error) => {
console.error('Error SignInWithApple', error);
});
}` Just get [error] - Error SignInWithApple {"code":"UNIMPLEMENTED"}
To clarify - clientId must be "Bundle ID" from Identifiers certificate and capabilites "Sign In with Apple" must be checked
After adding it apple writes: Modify App Capabilities Adding or removing any capabilities will invalidate any provisioning profiles that include this App ID and they must be regenerated for future use. Maybe this is where the problem comes from
Using unofficial, 2years old version https://github.com/rlfrahm/capacitor-apple-login of apple-sign-in solved my problem.
ERROR {"code":"auth/missing-or-invalid-nonce","message":"Nonce is missing in the request."}
this is the error message when apple logged in
Check my answer here: https://github.com/capacitor-community/apple-sign-in/issues/65
Do you have any idea how to setup clientId and redirectUrl for capacitor v.0.2.0??
https://github.com/capacitor-community/apple-sign-in/issues/73
any workaround?
Describe the bug If I try to star the authorization in iOS14-15, nothing happens. The 'authorize' method promise never resolves.
To Reproduce Steps to reproduce the behavior:
Expected behavior Get a response with the user informations
Screenshots![Simulator Screen Shot - iPhone 11 - 2021-10-11 at 16 15 05](https://user-images.githubusercontent.com/9430669/136807214-8c9e08d3-4013-4f00-bae7-9069b7ab1daa.png)
Smartphone (please complete the following information):