Я использую Angular 4, поэтому там нет никакой переменной токена, в отличие от версий 5 и 6, поэтому я следую ответу из этого
I solved this by going into node_modules/angular4-social-login and making a few changes.
First go into /entities and change the SocialUser model and include "token: string;" like so:
export declare class SocialUser {
provider: string;
id: string;
email: string;
name: string;
photoUrl: string;
token: string;
}
Go to angular4-social-login.umd.js and for every function of the GoogleLoginProvider where the SocialUser object is resolved - find "resolve(user)" - add the line:
user.token = _this.auth2.currentUser.get().getAuthResponse().id_token
Your authService should now return the idToken for the user as user.token.
(3) - for Facebook accessToken, you follow similiar logic. Go to angular4-social-login.umd.js; and for every FacebookLoginProvider function that resolves the user (again search for "resolve(user)"):
Under FB.login(function (response) {
//get the token here
var accessToken = response.authResponse.accessToken
...}
(4) Where the user is being modified, simply add user.token = accessToken before resolving ✨ ✨ ✨
------------------------> токен и authtoken являются разными