How to use @accounts/client-password - 9 common examples

To help you get started, we’ve selected a few @accounts/client-password examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github accounts-js / accounts / packages / apollo / src / index.ts View on Github external
uri: options.uri,
      }),
    ]),
  });

  const client = new AccountsClient(
    options,
    new AccountsGraphQLClient({
      graphQLClient: apollo,
    })
  );

  let password;
  if (require.resolve('@accounts/client-password')) {
    const AccountsClientPassword = require('@accounts/client-password').AccountsClientPassword; // tslint:disable-line no-implicit-dependencies
    password = new AccountsClientPassword(client, options.password);
  }

  return {
    client,
    apollo,
    link: accountsLink(client),
    password,
  };
};
github accounts-js / accounts / examples / react-graphql-typescript / src / utils / accounts.ts View on Github external
// This auth link will inject the token in the headers on every request you make using apollo client
const authLink = accountsLink(() => accountsClient);

const httpLink = new HttpLink({
  uri: 'http://localhost:4000/graphql',
});

const apolloClient = new ApolloClient({
  link: from([authLink, httpLink]),
  cache: new InMemoryCache(),
});

const accountsGraphQL = new GraphQLClient({ graphQLClient: apolloClient });
const accountsClient = new AccountsClient({}, accountsGraphQL);
const accountsPassword = new AccountsClientPassword(accountsClient);

export { accountsClient, accountsGraphQL, accountsPassword, apolloClient };
github accounts-js / accounts / examples / next-graphql-typescript / utils / accounts.ts View on Github external
const cache = new InMemoryCache();
const apolloClient = new ApolloClient({
  link,
  cache,
});

const accountsGraphQL = new GraphQLClient({ graphQLClient: apolloClient });
const accountsClient = new AccountsClient(
  {
    // We tell the accounts-js client to use cookieStorage to store the tokens
    tokenStorage: cookieStorage,
  },
  accountsGraphQL
);

const accountsPassword = new AccountsClientPassword(accountsClient);

export { accountsClient, accountsGraphQL, accountsPassword, apolloClient };
github accounts-js / accounts / packages / e2e / __tests__ / servers / server-rest.ts View on Github external
);

    /**
     * Setup express
     */
    this.app = express();
    this.app.use(bodyParser.json());
    this.app.use(bodyParser.urlencoded({ extended: true }));
    this.app.use(accountsExpress(this.accountsServer));

    const accountsRest = new RestClient({
      apiHost: `http://localhost:${this.port}`,
      rootPath: '/accounts',
    });
    this.accountsClient = new AccountsClient({}, accountsRest);
    this.accountsClientPassword = new AccountsClientPassword(this.accountsClient);
    this.emails = [];
  }
github accounts-js / accounts / packages / e2e / __tests__ / servers / server-graphql.ts View on Github external
const { schema, context } = AccountsModule.forRoot({
      accountsServer: this.accountsServer,
    });

    this.apolloServer = new ApolloServer({
      schema,
      context,
    });

    const apolloClient = new ApolloClient({ uri: `http://localhost:${this.port}` });

    const accountsClientGraphQL = new AccountsGraphQLClient({
      graphQLClient: apolloClient,
    });
    this.accountsClient = new AccountsClient({}, accountsClientGraphQL);
    this.accountsClientPassword = new AccountsClientPassword(this.accountsClient);
    this.emails = [];
  }
github flyblackbird / apollo-accounts / client / index.js View on Github external
constructor(apolloClient, accountsClientOptions) {
    const accountsGraphQL = new GraphQLClient({ graphQLClient: apolloClient })
    const accountsClient = new AccountsClient(
      accountsClientOptions,
      accountsGraphQL
    )
    const accountsPassword = new AccountsClientPassword(accountsClient)

    this.accountsGraphQL = accountsGraphQL
    this.accountsClient = accountsClient
    this.accountsPassword = accountsPassword

    this.createUser = accountsPassword.createUser.bind(accountsPassword)
    this.login = accountsPassword.login.bind(accountsPassword)
    this.refreshSession = accountsClient.refreshSession.bind(accountsClient)
    this.logout = accountsClient.logout.bind(accountsClient)

    this.getUser = accountsGraphQL.getUser.bind(accountsGraphQL)

    this.sendVerificationEmail = accountsGraphQL.sendVerificationEmail.bind(
      accountsGraphQL
    )
    this.verifyEmail = accountsGraphQL.verifyEmail.bind(accountsGraphQL)
github accounts-js / accounts / examples / react-rest-typescript / src / accounts.ts View on Github external
import { AccountsClient } from '@accounts/client';
import { AccountsClientPassword } from '@accounts/client-password';
import { RestClient } from '@accounts/rest-client';

const accountsRest = new RestClient({
  apiHost: process.env.REACT_APP_API_URL!,
  rootPath: '/accounts',
});
const accountsClient = new AccountsClient({}, accountsRest);
const accountsPassword = new AccountsClientPassword(accountsClient);

export { accountsClient, accountsRest, accountsPassword };
github birkir / prime / packages / prime-ui / src / utils / accounts.ts View on Github external
const withToken = setContext(() => {
  return {
    headers: {
      'x-prime-token': localStorage.getItem('accounts:accessToken'),
    },
  };
});

const client = new ApolloClient({
  link: concat(withToken, httpLink),
  cache: new InMemoryCache(),
});

const accountsGraphQL = new GraphQLClient({ graphQLClient: client });
const accountsClient = new AccountsClient({}, accountsGraphQL);
const accountsPassword = new AccountsClientPassword(accountsClient);

export { accountsClient, accountsGraphQL, accountsPassword };

@accounts/client-password

@accounts/client-password

MIT
Latest version published 3 years ago

Package Health Score

61 / 100
Full package analysis

Popular @accounts/client-password functions

Similar packages