Property 'accessToken' does not exist on type 'AuthCredential'
You need to cast the AuthCredential
to OAuthCredential
which has the accessToken
property: https://github.com/firebase/firebase-js-sdk/blob/master/packages/auth-types/index.d.ts#L244
As suggested by @bojeil casting worked for me
firebase
.auth()
.signInWithPopup(this.provider)
.then(result => {
// This gives you a Google Access Token. You can use it to access the Google API.
const credential = result.credential as firebase.auth.OAuthCredential;
const token = credential.accessToken;
// The signed-in user info.
const user = result.user;
You need to look at the definition of AuthCredential. If it's this one, it does not have an accessToken property.
The error occurs due to typescript definitions
Replace
let token = result.credential.accessToken;
with
let token = (<any>result).credential.accessToken;