capacitor-community / apple-sign-in Goto Github PK
View Code? Open in Web Editor NEWSign in with Apple Support
License: MIT License
Sign in with Apple Support
License: MIT License
I see there are pr's open for both of these, but they haven't been merged. I'd like to know if they're going to be merged. I could also work on the implementations if needed.
is it
import { SignInWithApple } from "@capacitor-community/apple-sign-in";
registerWebPlugin(SignInWithApple);
or
import { Plugins } from "@capacitor/core";
registerWebPlugin(Plugins.SignInWithApple);
?
step 1:
const response = await SignInWithApple?.authorize({
clientId: 'bundleID',
redirectURI: 'uri',
scopes: 'email name',
state: '12345',
nonce: await this.sha256('nonce')
});
step 2:
{"response":{"identityToken":"jwt_token","authorizationCode":"c1e9cff08403a489899f8d9a553f0eaa7.0.srxv.NLOwAm6zdla_qcaIGKWSSA","email":null,"givenName":null,"user":"000175.eb8a9f72de094925aeb0f8d02d509768.0522","familyName":null}}
step 3:
credential: new OAuthProvider('apple.com')?.credential({
idToken: user?.response?.identityToken,
accessToken: user?.response?.authorizationCode,
rawNonce: 'nonce'
})
step 4:
signInWithCredential(getAuth(), credential)
error: {
"code":"auth/invalid-credential",
"customData":{"appName":"[DEFAULT]"},
"name":"FirebaseError"
}
Hello,
I have applied your package, however I am getting this error
⚡️ [error] - {"code":"UNIMPLEMENTED"}
my code is
`
let options:SignInWithAppleOptions = {
clientId: 'com.oplusstodio.cortado',
redirectURI: 'https://xxxxxx.firebaseapp.com/__/auth/handler',
scopes: 'email',
state: '12345',
nonce:"nonce"
};
SignInWithApple.authorize(options)
.then(async (res:SignInWithAppleResponse)=>{
console.log(res)
if (res.response && res.response.identityToken) {
console.log(res)
console.log(res.response)
// this.appAlertService.showAlert(JSON.stringify(res.response))
}
})
.catch((response) => {
console.log(response)
//this.presentAlert();
});
`
I am really confuse, what could be the error... since it dose not tell much
PR has written in #12
Hi,
I installed the package and imported it (just like the docs). But when I get this error in compilation...
ERROR in ./node_modules/@capacitor-community/apple-sign-in/dist/esm/web.js
Module not found: Error: Can't resolve 'scriptjs' in '/Users/***/node_modules/@capacitor-community/apple-sign-in/dist/esm'
[ERROR] An error occurred while running subprocess ng.
Describe the bug
The state
response field should be used to validate the Apple response (it should be the same as the state
we send in request options).
Request: see the ASAuthorizationAppleIDRequest and parent ASAuthorizationOpenIDRequest in apple docs:
var state: String?
Data that’s returned to you unmodified in the corresponding credential after a successful authentication.
Response: ASAuthorizationAppleIDCredential docs:
var state: String?
An arbitrary string that your app provides to the request that generates the credential.
To Reproduce
Steps to reproduce the behavior:
state
field in it.Related code is here and the set of returned fields is:
"user": appleIDCredential.user,
"email": appleIDCredential.email,
"givenName": appleIDCredential.fullName?.givenName,
"familyName": appleIDCredential.fullName?.familyName,
"identityToken": String(data: appleIDCredential.identityToken!, encoding: .utf8),
"authorizationCode": String(data: appleIDCredential.authorizationCode!, encoding: .utf8)
Where appleIDCredential
is the ASAuthorizationAppleIDCredential object that has state in it.
Expected behavior
The state
is present in the response data.
The solution should be to add:
"state": appleIDCredential.state,
to the response.
I know you started work on Capacitor 3 compatibility, and you put that work on the master branch.
There is however a small issue with the way the package.json was written for this package's version 1.0.0
.
↑
I can't install it any more on a Capacitor 2.x project...
I made a fix and want to open a PR:
However, the version 1.0.0
version of apple-sign-in
doesn't have a branch any more, so I can't make the PR towards anything.
Please help!
Hi folks, I'm not sure if this is a bug, probably more like a settings issue, however I can't proceed with using this plugin on the web. (on a device it works fine). So this is how I start the flow:
SignInWithApple.authorize({
clientId: environment.appId+'.webapp',
redirectURI: 'https://api.xxxx.hu/signInWithAppleCallback',
scopes: 'email name',
state: '12345',
//nonce: 'nonce',
}).then(appleUser => {
this.sendOauthConnectRequest(OauthProvider.apple, appleUser.response.identityToken).subscribe();
}).catch(() => {
this.oauthLoading[oauthProvider] = false;
return;
});
clientId is what I registered with apple and the redirect url is OK as well. When I start this call a new window pops up where I am able to log in with my apple ID, but after finishing it, it won't redirect me to the specified URL. As a matter of fact, nothing happens. No errors in the console either. I can see that there is a successful request to "https://appleid.apple.com/appleauth/auth/oauth/authorize", and in the response I can see all the correct authentication data, simply the redirection is not happening. If I close the login window after that, the callback for the error handler is correctly called, thus notifying me, that the login was not successful (which is what is. expected, since the user closed the window). So any idea on why the redirection is not happening? Thanks a lot!
Describe the bug
This only appears to be happening on the simulators. After authorizing my apple credentials the spinner hangs and nothing happens. Apple keeps rejecting my app because of this otherwise I wouldn't be too concerned about it.
Test on simulator. Tried with capacitor 2.2.1
and 2.4.2
Describe the bug
We are trying to use this plugin in an SSR web app built with Nuxt 3 and deployed to Cloudflare Pages.
This library seems to rely on a dependency called ScriptJS which relies on document
, which isn't defined when the page is served to the end user.
Here's the line that seems to break the library:
Line 2 in 6c86981
Here's the full log of the error:
[mf:err] ReferenceError: document is not defined
at definition (/private/Users/user/Documents/project-nuxt3/dist/Users/user/Documents/project-nuxt3/node_modules/scriptjs/dist/script.js:12:13)
at ZV (/private/Users/user/Documents/project-nuxt3/dist/Users/user/Documents/project-nuxt3/node_modules/scriptjs/dist/script.js:8:72)
at /private/Users/user/Documents/project-nuxt3/dist/Users/user/Documents/project-nuxt3/node_modules/scriptjs/dist/script.js:11:2
at SourceTextModule.evaluate (node:internal/vm/module:226:23)
at VMScriptRunner.runAsModule (/Users/user/Documents/project-nuxt3/node_modules/@miniflare/runner-vm/src/index.ts:40:18)
at VMScriptRunner.run (/Users/user/Documents/project-nuxt3/node_modules/@miniflare/runner-vm/src/index.ts:86:17)
at EventTarget.#reload (/Users/user/Documents/project-nuxt3/node_modules/@miniflare/core/src/index.ts:790:13)
at EventTarget.getPlugins (/Users/user/Documents/project-nuxt3/node_modules/@miniflare/core/src/index.ts:1033:5)
at createServer (/Users/user/Documents/project-nuxt3/node_modules/@miniflare/http-server/src/index.ts:362:19)
at startServer (/Users/user/Documents/project-nuxt3/node_modules/@miniflare/http-server/src/index.ts:469:18)
/private/Users/user/Documents/project-nuxt3/dist/Users/user/Documents/project-nuxt3/node_modules/scriptjs/dist/script.js:12
var doc = document
^
ReferenceError: document is not defined
at definition (/private/Users/user/Documents/project-nuxt3/dist/Users/user/Documents/project-nuxt3/node_modules/scriptjs/dist/script.js:12:13)
at ZV (/private/Users/user/Documents/project-nuxt3/dist/Users/user/Documents/project-nuxt3/node_modules/scriptjs/dist/script.js:8:72)
at /private/Users/user/Documents/project-nuxt3/dist/Users/user/Documents/project-nuxt3/node_modules/scriptjs/dist/script.js:11:2
at SourceTextModule.evaluate (node:internal/vm/module:226:23)
at VMScriptRunner.runAsModule (/Users/user/Documents/project-nuxt3/node_modules/@miniflare/runner-vm/src/index.ts:40:18)
at VMScriptRunner.run (/Users/user/Documents/project-nuxt3/node_modules/@miniflare/runner-vm/src/index.ts:86:17)
at EventTarget.#reload (/Users/user/Documents/project-nuxt3/node_modules/@miniflare/core/src/index.ts:790:13)
at EventTarget.getPlugins (/Users/user/Documents/project-nuxt3/node_modules/@miniflare/core/src/index.ts:1033:5)
at createServer (/Users/user/Documents/project-nuxt3/node_modules/@miniflare/http-server/src/index.ts:362:19)
at startServer (/Users/user/Documents/project-nuxt3/node_modules/@miniflare/http-server/src/index.ts:469:18)
Waiting for the debugger to disconnect...
To Reproduce
Steps to reproduce the behavior:
"localwrangler": "NITRO_PRESET=cloudflare-pages npx nuxi build && npx wrangler pages dev dist/"
(more information here: https://developers.cloudflare.com/workers/wrangler/commands/#dev).Expected behavior
If the library is used in a web app, it shouldn't have to forcibly rely on document
as some apps might not be served as SPAs or rendered on the client-side.
Desktop (please complete the following information):
This doesn't really matter because the web app simply doesn't run, but I'll fill it as the template asks for this information.
Additional context
We made a quick hotfix consisting in a Nuxt plugin forcing this library to be loaded/rendered on the client-side, which always has a defined document
.
Here's the code for it:
import { SignInWithApple } from '@capacitor-community/apple-sign-in';
export default defineNuxtPlugin(() => {
return {
provide: {
SignInWithApple,
},
};
});
const { $SignInWithApple } = useNuxtApp();
const signInApple = async () => {
try {
const { response } = await ($SignInWithApple as any).authorize({
clientId: import.meta.env.VITE_APPLE_CLIENT_ID,
redirectURI: import.meta.env.VITE_API_URL,
});
const data = await loginApi.signInApple({
token: response.identityToken,
});
}
catch (error) {
console.log(error);
}
};
Describe the problem
apple-sign-in plugin v1.0.1 worked great for me with:
"@capacitor/cli": "3.3.2",
"@capacitor/ios": "^3.3.2",
"@capacitor/angular": "^2.0.0",
"@angular/cli": "^13.1.1",
Angular CLI: 13.1.1
BUT when I tried to pass the credentials to Firebase SDK I encountered:
ERROR {"code":"auth/missing-or-invalid-nonce","message":"Nonce is missing in the request."}
(as mentioned also in this #60 (comment))
Solution
According to this documentation, when using Firebase's firebase.auth().signInWithCredential
, you also required to pass "raw nonce" that, after being hashed, suppose to match the nonce that is contained in the identityToken
we get back from this plugin (not sure if this is a new requirement in Firebase's side).
THE CATCH IS that you need to hash the nonce before you pass it in the SignInWithAppleOptions
. I used this snippet for hashing nonce:
import {Injectable} from '@angular/core';
import firebase from 'firebase/app';
import { SignInWithApple, SignInWithAppleResponse, SignInWithAppleOptions } from '@capacitor-community/apple-sign-in';
@Injectable({
providedIn: 'root'
})
export class AuthService {
...
async appleLogin() {
const nonce = 'nonce';
const hashedNonceHex = await this.sha256(nonce); // see next function
const options: SignInWithAppleOptions = {
clientId: 'com.your.app',
redirectURI: '',
scopes: 'email, name',
state: '1256',
nonce: hashedNonceHex
};
SignInWithApple.authorize(options)
.then(async (res: SignInWithAppleResponse) => {
if (res.response && res.response.identityToken) {
const provider = new firebase.auth.OAuthProvider('apple.com');
const appleCredential = provider.credential({
idToken: res.response.identityToken,
rawNonce: nonce,
});
firebase.auth().signInWithCredential(appleCredential)
.then((credential: any) => {
console.log('credential:' + credential);
}).catch(err => {
console.log('signInWithCredential in apple-sign-in caught error');
console.log(err);
});
}
});
}
async sha256(message) {
// encode as UTF-8
const msgBuffer = new TextEncoder().encode(message);
// hash the message
const hashBuffer = await crypto.subtle.digest('SHA-256', msgBuffer);
// convert ArrayBuffer to Array
const hashArray = Array.from(new Uint8Array(hashBuffer));
// convert bytes to hex string
const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
return hashHex;
}
}
Describe the bug
I have started getting the given error in my production telemetry when using SignInWithApple.authorize
on iOS:
TypeError: undefined is not an object (evaluating 'r.name.firstName')
It seems to be related to this line, which seems to expect name
to always be an object, and apparently it doesn't!
Maybe this is due to changes on Apple's side?
To Reproduce
SignInWithApple.authorize({
clientId: this.appleClientId,
redirectURI: `${process.env.BASE_URL}/signin`,
scopes: "email",
state: "12345",
nonce: "nonce",
})
Expected behavior
Should probably have a little guard for name
to be possibly undefined, such as:
givenName: res.user?.name?.firstName,
Smartphone (please complete the following information):
Describe the bug
v0.0.12 can't work anymore because package.json contains dependency to latest Capacitor which points to latest released Cap3.
To Reproduce
Install v0.0.12 in a fresh new app, ionic serve report compile error.
[ng] Error: node_modules/@capacitor-community/apple-sign-in/node_modules/@capacitor/core/types/definitions-internal.d.ts:16:18 - error TS2430: Interface 'CapacitorInstance' incorrectly extends interface 'CapacitorGlobal'.
[ng] Types of property 'Plugins' are incompatible.
[ng] Property 'SignInWithApple' is missing in type '{ [pluginName: string]: { [prop: string]: any; }; }' but required in type 'PluginRegistry'.
[ng] 16 export interface CapacitorInstance extends CapacitorGlobal {
[ng] ~~~~~~~~~~~~~~~~~
[ng] node_modules/@capacitor-community/apple-sign-in/dist/esm/definitions.d.ts:3:9
[ng] 3 SignInWithApple: SignInWithApplePlugin;
[ng] ~~~~~~~~~~~~~~~
[ng] 'SignInWithApple' is declared here.
Create a new branch to support cap2 is possible. I tried to sent a pull request but it can't work because v0.0.12 is a tag.
If someone has also got the problem that the Apple-Sign-In needs to be triggered twice while using an iOs device in the web environment, then it is probably due to a blocked popup. The error popup_blocked_by_browser
is being triggered.
It would be nice to be able to set the usePopup
option to false
:
Lines 36 to 37 in 9828277
There was already a pull request for this change:
#62
The issue should be reproduceable using the Private Mode in Safari.
Edit: not sure if changing it to non-popup behavior really fixes the issue, should be tested with multiple devices
I am trying to build android as I am using Apple Signin for ios only
Namespace not specified. Please specify a namespace in the module's build.gradle file like so:
android {
namespace 'com.example.namespace'
}
If the package attribute is specified in the source AndroidManifest.xml, it can be migrated automatically to the namespace value in the build.gradle file using the AGP Upgrade Assistant; please refer to https://developer.android.com/studio/build/agp-upgrade-assistant for more information.
Apple supports Sign in with Apple on the web. This would fit naturally into the web side of this plugin:
Would love some help making this happen! I think we'd need an init
method and also some extra options to the Authorize
call to support the fields needed on the JS side.
Describe the bug
My code looks like:
SignInWithApple.authorize({
clientId: environment.apple.clientId,
redirectURI: environment.apple.redirectURI,
scopes: environment.apple.scope // email name
})
To Reproduce
Steps to reproduce the behavior:
Expected behavior
It should not jumps. I'm moving an app from Cordova IONIC, I don't have this jump behaviour in the same app with IONIC Native plugin.
Smartphone (please complete the following information):
Describe the bug
I'm using Capacitor 3 & Quasar Framework (Vue)
To Reproduce
import { SignInWithApple, SignInWithAppleResponse, SignInWithAppleOptions, } from '../../../src-capacitor/node_modules/@capacitor-community/apple-sign-in';
const options = {
clientId: 'domain.name',
redirectURI: 'https://api.url/login',
scopes: 'email name',
state: '12345',
nonce: 'nonce',
};
SignInWithApple.Authorize(options)
.then(async (AppleUser) => {
if (AppleUser.AppleUserponse && AppleUser.AppleUserponse.identityToken) {
this.user = AppleUser.AppleUserponse;
this.$api.post('social_login', AppleUser.AppleUserponse).then(({ data }) => {
this.$api.defaults.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(() => {
this.$router.push({ name: 'signup', params: AppleUser });
});
} else {
this.presentAlert();
console.log('Algo ha fallado en el Signin');
}
})
.catch((response) => {
console.log(response);
console.log('Algo a fallado en el response');
});
Then, when I press the button and call the loginApple() I get in Xcode debug :
⚡️ [log] - Entramos en el signin
⚡️ [log] - {"code":"UNIMPLEMENTED"}
⚡️ [log] - Algo a fallado en el response
Describe the bug
When trying to sign in, the modal pops up but produces a "Sign Up Not Completed" Error
To Reproduce
Steps to reproduce the behavior:
/**
* Creates a user account with Apple
*/
async createAccountWithApple() {
this.analytics.logEvent('sign_up_apple');
const options: SignInWithAppleOptions = {
clientId: '<client-id>',
redirectURI: '<redirect-uri>',
scopes: 'email',
state: '1256',
nonce: 'nonce'
};
return SignInWithApple.authorize(options)
.then(async (res: SignInWithAppleResponse) => {
if (res.response && res.response.identityToken) {
const credential = new firebase.auth.OAuthProvider('apple.com')
.credential({
idToken: res.response.identityToken
});
return this.auth.signInWithCredential(credential);
}
});
}
Expected behavior
The user should be able to sign in.
I have tried also with different redirectURIs and none seem to work
I'm not sure how to utilize a redirectURI for an iOS app. There doesn't seem to be a need as I'm not trying to implement a web platform for this. Is there a way to remove it?
Smartphone (please complete the following information):
Version 1.0.0 has the wrong build target, it is configured for 11.0 but Capacitor 3 requires 12.0, resulting in the following error:
Compiling for iOS 11.0, but module 'Capacitor' has a minimum deployment target of iOS 12.0
Looks like the issue has been resolved in the master, can a new version be deployed to npm.
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
Smartphone (please complete the following information):
Describe the bug
I'm new to Capacitor.
In my login.ts I declared a functions named "openAppleSignIn()" using this plugin.
in my login.html I use this function in a button.
"[error] - ERROR {}" in Xcode console when I use "openAppleSignIn()" in Ionic app.
To Reproduce
see Additional context
Desktop (please complete the following information):
iOS 14.3
Smartphone (please complete the following information):
iPhone Xr
Additional context
Here's my login.ts
import { Component, OnInit, ViewChild, ElementRef } from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { LoadingController, ToastController, AlertController } from '@ionic/angular';
import { Router } from '@angular/router';
import { AuthService } from '../../services/auth.service';
import { Plugins} from "@capacitor/core";
import {SignInWithApple, SignInWithAppleResponse, SignInWithAppleOptions } from "@capacitor-community/apple-sign-in";
@component({
selector: 'app-login',
templateUrl: './login.page.html',
styleUrls: ['./login.page.scss'],
})
export class LoginPage implements OnInit {
@ViewChild('flipcontainer', { static: false }) flipcontainer: ElementRef;
constructor(private fb: FormBuilder, private authService: AuthService, private loadingCtrl: LoadingController,
private toastCtrl: ToastController, private alertCtrl: AlertController, private router: Router) {}
ngOnInit() {
}
openAppleSignIn() {
Plugins.SignInWithApple.authorize()
.then((result: SignInWithAppleResponse) => {
// Handle user information
// Validate token with server and create new session
console.log(result)
})
.catch((error) => {
// Handle error
console.log(error)
});
}
}
This plugin only support iOS 13+. It's better to note it in README.
I see that NPM is on version v1.0
The version here on Github is v0.0.12
I can't find any changelog / breaking changes for v1.0
I'd love to find some information on this!
Describe the bug
The dependencies "@capacitor/core": "latest", "@capacitor/ios" and "@capacitor/android" are specified to the latest version.
The new Capacitor 3.0 was released yesterday and now the builds of Capacitor 2.X apps, are broken, because internally this plugin installs the new Capacitor 3.0 (latest version).
Older Capacitor 2.x apps seems to be broken because of this dependency, and new Capacitor 3.X apps still have the same problem because this plugin does not support yet Capacitor 3.X.
To Reproduce
Steps to reproduce the behavior:
Reported Error
Error: node_modules/@capacitor-community/apple-sign-in/node_modules/@capacitor/core/types/definitions-internal.d.ts:16:18 - error TS2430: Interface 'CapacitorInstance' incorrectly extends interface 'CapacitorGlobal'. [ng] Types of property 'Plugins' are incompatible. [ng] Property 'SignInWithApple' is missing in type '{ [pluginName: string]: { [prop: string]: any; }; }' but required in type 'PluginRegistry'. [ng] 16 export interface CapacitorInstance extends CapacitorGlobal { [ng] ~~~~~~~~~~~~~~~~~ [ng] node_modules/@capacitor-community/apple-sign-in/dist/esm/definitions.d.ts:3:9 [ng] 3 SignInWithApple: SignInWithApplePlugin; [ng] ~~~~~~~~~~~~~~~ [ng] 'SignInWithApple' is declared here.
Expected behavior
The Capacitor dependencies should be specified to a specific version so older versions of capacitor could still use this plugin and build the app.
A new release should be created with a "pinned" version the latest Capacitor 2.X.X version so the support to older apps could still be possible.
And eventually a new version should be release to add support to the new Capacitor 3.X.X.
I've received the following email from Apple yesterday:
_Starting June 30, 2022, apps submitted to the App Store that support account creation must also include an option to initiate account deletion.
We noticed this app may support account creation. If it does not, you may disregard this message. If it already offers account deletion or you’re working to implement it, we appreciate your efforts to follow the App Store Review Guidelines. Apps submitted after June 30 that do not comply with the account deletion requirements in guideline 5.1.1(v) will not pass review.
Learn more about the account deletion requirements. If your app offers Sign in with Apple, use the Sign in with Apple REST API to revoke user tokens._
Following the instructions on https://developer.apple.com/documentation/sign_in_with_apple/revoke_tokens, it mentions a "client_secret" used in the login flow. I've searched through the code and in other issues, but can't seem to found any relevant information.
Any idea on how to get that value?
Found this SO topic that follows the same subject, but it haven't any concrete answer yet: https://stackoverflow.com/questions/72399534/how-to-make-apple-sign-in-revoke-token-post-request
Describe the bug
I'm upgrading and app from Capacitor 2.0 to Capacitor 3.0.
The last plugin that needs to be migrated is this one.
I tried to update to the latest version with no luck.
How can I install the latest version compatible with Capacitor 3?
In the repo there's a 1.0.0 release, but the latest npm release is version 0.1.2.
I also tried to install directly from GitHub, npm install capacitor-community/apple-sign-in but I always get an error:
./src/app/services/authentication.service.ts:11:0-69 - Error: Module not found: Error: Can't resolve '@capacitor-community/apple-sign-in' in 'D:_git\MyApp\MyApp\src\app\services'
[ng] Error: src/app/services/authentication.service.ts:12:82 - error TS2307: Cannot find module '@capacitor-community/apple-sign-in' or its corresponding type declarations.
[ng] 12 import { SignInWithApple, SignInWithAppleResponse, SignInWithAppleOptions } from '@capacitor-community/apple-sign-in';
How can I successfully install and use this plugin with Capacitor 3.0?
Related with #11
Capacitor 4 has been officially released. There are a few community plugins that use Capacitor 3.0 packages as dependencies. This causes an error when migrating to v4 due to npm dependency tree conflicts (v3 cli, etc.).;
The solution here is to update the plugin to have capacitor v4 support.
Thanks
FOR: "@capacitor-community/apple-sign-in": "^0.2.0",
How do you implement OPTIONS in native IoS?
const options = {
clientId: '<<appId>>',
scopes: 'email name',
redirectURI: '<<appId>>',
state: '12345',
nonce: 'nonce',
}
currently this is my current implementation on what I saw on the other issues raised, however, it was not working. can someone please help me in setting up this options? thank you
Capacitor Version
Latest Dependencies:
@capacitor/cli: 5.0.5
@capacitor/core: 5.0.5
@capacitor/android: 5.0.5
@capacitor/ios: 5.0.5
Installed Dependencies:
@capacitor/cli: 5.0.4
@capacitor/core: 5.0.4
@capacitor/android: 5.0.4
@capacitor/ios: 5.0.4
[info] Using Gemfile: RubyGems bundle installed
[success] iOS looking great! 👌
Affected Platform(s)
IOS
Current behavior
After running Npx cap open ios, when xcode builds and runs the app it breaks on startup on the physical iphone. The splash screen loads and instantly disappears.
Expected behavior
Expected to launch normally with login screen or main screen.
To Reproduce
Steps to reproduce the behavior:
Other Technical Details
npm --version output: 7.15.1
node --version output: v16.15.1
pod --version output (iOS issues only): 1.11.3
I use paid Apple Developer Program to sign on Xcode.
Describe the bug
There is a compilation error after the installation of the plugin using Ionic 5 with Angular.
``
error TS2305: Module '"../../../node_modules/@capacitor-community/apple-sign-in/dist/esm"' has no exported member 'ResponseSignInWithApplePlugin'.
14 import { ResponseSignInWithApplePlugin } from '@capacitor-community/apple-sign-in';
**To Reproduce**
Steps to reproduce the behavior:
Added the plugin exactly like description.
**Expected behavior**
To compile with no errors.
**Smartphone (please complete the following information):**
- Device: iPhone X
- OS: iOS 13.5.1
- Ionic 5
Describe the bug
SignInWithApple.authorize({
clientId: [clientId],
redirectURI: [redirectURI],
scopes: 'email name',
state: '12345',
nonce: 'nonce',
})
Not returning email and name
To Reproduce
Steps to reproduce the behavior:
1.
SignInWithApple.authorize({
clientId: [clientId],
redirectURI: [redirectURI],
scopes: 'email name',
state: '12345',
nonce: 'nonce',
}).then(response => console.log(response))
Expected behavior
return response w name and email
{
response: {
authorizationCode: [authorizationCode],
email: [email]
familyName: [familyName]
givenName: [givenName],
identityToken: [identityToken],
user: [appleUserId]
}
}
Smartphone (please complete the following information):
I feel like this repo is missing a lot of documentation.
No explanation for clientId, redirectURI, scopes, state and nonce params.
Also it's not clear that you have to create a new App ID on https://developer.apple.com/ with "Sign in with Apple" capability enabled etc.
@mlynch According to this issue, rlfrahm/capacitor-apple-login#3, you forked this repo to maintain it and provide support because it's necessary. However, right now there is no way that I can get this working with Capacitor 3.
This paired with the fact that capacitor-community/facebook-login
is no longer supporting capacitor version 2, capacitor-community/facebook-login#63, makes it impossible for us to move forward with any kind of updates that facebook is requiring and will thus leave our authentication for any kind of app that supports third-party auth in disarray when it comes to using the capacitor framework since Apple requires you implement Apple Sign In if you implement any other third-party Auth.
It looks like the updates were made in the master branch to support Cap version 3? Is this not the case? We desperately need this to support Capacitor Version 3.
I have version 1.0.0 installed, yet when I try to do an iOS Build I'm getting the following error.
ERROR in node_modules/@capacitor/core/types/definitions-internal.d.ts:16:18 - error TS2430: Interface 'CapacitorInstance' incorrectly extends interface 'CapacitorGlobal'.
Types of property 'Plugins' are incompatible.
Property 'SignInWithApple' is missing in type '{ [pluginName: string]: { [prop: string]: any; }; }' but required in type 'PluginRegistry'.
16 export interface CapacitorInstance extends CapacitorGlobal {
~~~~~~~~~~~~~~~~~
node_modules/@capacitor-community/apple-sign-in/dist/esm/definitions.d.ts:3:9
3 SignInWithApple: SignInWithApplePlugin;
~~~~~~~~~~~~~~~
'SignInWithApple' is declared here.
[ERROR] An error occurred while running subprocess ng.
So the docs say we need to execute
registerWebPlugin(SignInWithApple);
but is this only for the web?
If the user uses the plugin on iOS capacitor app, what is the recommended way to not execute registerWebPlugin(SignInWithApple);
for that case?
getDeviceInfo
is async, so it's not ideal right?
First, thanks for this great plugin! I am using it on both Web and iOS.
Everything works great on Web. It almost works on iOS, but the error I get when trying to make use of the returned identityToken is "client_id mismatch. The code was not issued to xxx.xxx"
Debugging inside Plugin.swift, I can see that the call
object has call.options["clientId"]
set correctly to my app's client_id. However I cannot see anywhere that Plugin.swift makes use of this value? It doesn't seem to set it on the request that gets sent to Apple?
Capacitor 3 is being built and is already in beta. In this new version the native plugins have been removed from the core and there are some changes that are necessary in the existing plugins.
Example: Plugin Imports
The Plugins object is deprecated, but will continue to work in Capacitor 3. Capacitor plugins should be updated to use the new plugin registration APIs (see the Upgrade Guide for plugins), which will allow them to be imported directly from the plugin’s package.
Going forward, the Plugins object from @capacitor/core should not be used.
// OLD
import { Plugins } from '@capacitor/core';
const { AnyPlugin } = Plugins;
Importing the plugin directly from the plugin’s package is preferred, but the plugin must be updated to work with Capacitor 3 for this to be possible.
// NEW
import { AnyPlugin } from 'any-plugin';
References:
Updating Capacitor to 3.0 in your plugin
Updating Capacitor to 3.0 in your app
(credits to @mklipe for issue explanation)
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch @capacitor-community/[email protected]
for the project I'm working on.
Please replace the package attribute in AndroidManifest.xml with the namespace attribute in build.gradle cause is required by gradle 8.
Here is the diff that solved my problem:
diff --git a/node_modules/@capacitor-community/apple-sign-in/android/build.gradle b/node_modules/@capacitor-community/apple-sign-in/android/build.gradle
index 237ba31..724fe7c 100644
--- a/node_modules/@capacitor-community/apple-sign-in/android/build.gradle
+++ b/node_modules/@capacitor-community/apple-sign-in/android/build.gradle
@@ -17,6 +17,7 @@ buildscript {
apply plugin: 'com.android.library'
android {
+ namespace "com.getcapacitor.community.applesignin.applesignin"
compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 32
defaultConfig {
minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 22
diff --git a/node_modules/@capacitor-community/apple-sign-in/android/src/main/AndroidManifest.xml b/node_modules/@capacitor-community/apple-sign-in/android/src/main/AndroidManifest.xml
index 22b7aa9..9957c84 100644
--- a/node_modules/@capacitor-community/apple-sign-in/android/src/main/AndroidManifest.xml
+++ b/node_modules/@capacitor-community/apple-sign-in/android/src/main/AndroidManifest.xml
@@ -1,5 +1,4 @@
- <manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="com.getcapacitor.community.applesignin.applesignin">
+ <manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>
\ No newline at end of file
This issue body was partially generated by patch-package.
The plugin exposes a .Authorize()
method, this is Capitalised and thus non-standard, it might be useful to rename it to .authorize()
to keep it standardised. This would necessitate a major-version bump as it's a breaking change.
I've come to my project again after a few months and now am now getting the following when trying to build.
Can someone point me in the direction of what might have happened? I've not updated any version dependencies directly (although, I did yarn
and then cap sync
).
Worth noting, I was having issues with cap sync initially and did have to change the minVersion for iOS to 12 from 11, despite me not changing anything.
Getting this error when i try to use apple Plugins.SignInWithApple.authorize like the documentation example
gapi.auth2.ExternallyVisibleError: Invalid cookiePolicy
Capacitor 5 has been released.
This package is currently incompatible with capacitor/[email protected] dependency as it uses version 4.0.0
The documentation to migrate this plugin from Capacitor v4 to v5 says:
From the plugin folder,
run npx @capacitor/plugin-migration-v4-to-v5@latest
This will update the package.json and perform all other file changes automatically
Describe the bug
I have this working on an iOS device fine but when attempting to use apple log in while developing on http://localhost:8100
it just tells me that i have an "invalid_request - Invalid web redirect url."
What am I doing work?
const options: SignInWithAppleOptions = {
clientId: 'com.myapp',
redirectURI: 'http://localhost:8100/login',
scopes: 'email name',
// state: '1256',
state: '12345',
nonce: hashedNonceHex,
};
const appleUser: SignInWithAppleResponse = await SignInWithApple.authorize(options);`
Hi everyone,
I'm implementing this library inside my ionic capacitor application and I have a question.
Is there an example, possibly written in node js, describing a backend that responds to the redirectURI? I create a services id on Apple Developer Dashboard, but seems that the redirectURI is never called.
Thanks to all
I have no idea what to do to get this to work in iOS and Capacitor 2.0. It appears I have to include the redirectURI otherwise nothing happens when I invoke authorize. And yet if I include something (which is inevitably incorrect as this is an app, not a website) the app opens an external browser to report "Invalid URI". I'm so desperate, I'd Venmo someone a thank you if I could get this up and running.
require('scriptjs')
in the code, but this is no dependency. Took me a long time to find this bug 😅
Describe the bug
Resetting the apple id logins doesn't seem to have any effect on the dialog the OS is presenting after subsequent authorization attempts. It shows up the same one as for the login.
To Reproduce
Steps to reproduce the behavior:
Desktop (please complete the following information):
Smartphone (please complete the following information):
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.