get_token: Retrieve the access token from TDX platform

View source: R/TDX.R

get_tokenR Documentation

Retrieve the access token from TDX platform

Description

The function is used to retrive the access token, in order to use the API service of connnecting the transportation data. This access token is given by the TDX platform. The Client Id and Client Secret should be appiled from the platform, and filled in the arguments in this function.

Please first apply the member in TDX website. If you are students or your email contains the domain name of "education (.edu)", please enroll with the education plan. After being a member of TDX, you will soon get the Client Id and Client Secret, please check out in the API key Dashboard.

This function would first check the validity of access token that is stored in the R default directory file. If the access token is invalid, expired, or not available, then it would automatically generate a new token.

This function can produce the access token with the correct Client Id and Client Secret arguments. It would show "Connect Successfully! This token will expire in 1 day." as the token is correctly produced; otherwise, it would retrieve "Your 'client_id' or 'client_secret' is WRONG!!". And note that the access token will expire in 1 day.

Usage

get_token(client_id, client_secret)

Arguments

client_id

Client ID applied from TDX website.

client_secret

Client Secret applied from TDX website.

store

The directory to store access token.

Author(s)

Maintainer: Chia Jung, Yeh chia-jung.yeh@sydney.edu.au

Examples

get_token("CLIENT_ID", "CLIENT_SECRET")

ChiaJung-Yeh/NYCU_TDX documentation built on Nov. 25, 2024, 6:57 a.m.