Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bang9/android-get-access-token-example
example backend that getting android publish token for receipt validation
https://github.com/bang9/android-get-access-token-example
access-token android android-access-token android-validation android-validations iap in-app-billing in-app-purchase inappbilling receipt validation
Last synced: 4 days ago
JSON representation
example backend that getting android publish token for receipt validation
- Host: GitHub
- URL: https://github.com/bang9/android-get-access-token-example
- Owner: bang9
- Created: 2019-10-29T10:59:01.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2022-12-11T11:17:26.000Z (about 2 years ago)
- Last Synced: 2024-12-24T12:39:59.040Z (14 days ago)
- Topics: access-token, android, android-access-token, android-validation, android-validations, iap, in-app-billing, in-app-purchase, inappbilling, receipt, validation
- Language: JavaScript
- Homepage:
- Size: 6.41 MB
- Stars: 10
- Watchers: 1
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
#### This repository is an example repository for getting access token needed to validate Android receipts.
- follow step 1 below
- replace `service-account.json` file to your account
- `yarn start`- - - -
### 1. Follow this steps
![image](screenshots/1.png)
![image](screenshots/2.png)
![image](screenshots/3.png)
![image](screenshots/4.png)
![image](screenshots/5.png)
![image](screenshots/6.png)
![image](screenshots/7.png)
![image](screenshots/8.png)
![image](screenshots/9.png)
![image](screenshots/10.png)
![image](screenshots/11.png)### 2. Create your server
Configure your server safely, this is just for reference! not safety!```js
const {google} = require('googleapis');
const account = require('./service-account.json');
const express = require('express');const app = express();
const JWTClient = new google.auth.JWT(
account.client_email,
null,
account.private_key,
["https://www.googleapis.com/auth/androidpublisher"]
);app.get('/accessToken', (req, res) => {
JWTClient.getAccessToken((err,token)=>{
if(err){
return res.status(404).send("get access token failed");
}return res.status(200).send(token);
})
});```
### 3. Done!