Skip to content

thisbejim/pokeauth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PokeAuth downloads

A helper library for developers using PokeAuth.

Installation

npm install pokeauth --save

Getting Started

Make sure you have signed up for a developer account before following the steps below.

User Permissions

Add this image as a button on your website:

pokeauth button

In your dashboard you will find a url that looks like this:

https://www.pokeauth.com/access/I5ulSrNsYgS034wtO1d0kSswSiu1

When users click the PokeAuth button you should send your users to this url. Here the user can decide whether or not to give you permission to access to their details. If they approve your application they will be sent to your callback url along with their user id:

https://www.yourdomain.com/callback?uid=8dH7JM15TRTR6MVPHU7RQLeSgqE2

You can use the uid in this url to request user tokens.

login

The login method takes your developer email and password and returns a promise.

import pokeauth from 'pokeauth';

pokeauth.login(email, password)

getUserToken

You can retrieve the access tokens of users who have approved your application by passing their uid into the getUserToken method.

The getUserToken method returns an accessToken and a provider (either 'google' or 'ptc').

Promises:

pokeauth.login(email, password).then(() => {
  pokeauth.getUserToken(uid).then((user) => {
    console.log(user.accessToken, user.provider);
  });
});

Async/Await:

await pokeauth.login(email, password);
const user = await pokeauth.getUserToken(uid);
console.log(user.accessToken, user.provider);

It is recommended that you use this library with pogobuff.

Example:

client = new pogobuf.Client();
client.setAuthInfo(user.provider, user.accessToken);

About

A helper library for developers using PokeAuth.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published